Unless you're storing the metars.txt file in the root directory of your server (which is plausible), this shouldn't work. On the other hand, the extra "." would work if the DOCUMENT_ROOT for your webserver is set correctly AND has a slash at the end.
Generally, a "double slash" will be correctly interpreted as a single slash in a directory name, so "/var/www/html/" and "./whatever" should work as well as "/var/www/html" and "./whatever". On the other hand, if your document root is set to "/var/www/html", the period will cause all kinds of problems.
If DOCUMENT_ROOT is not set at all, the "./" should open the file in whatever "root" directory the process is running, and there's no clean way of predicting that for all platforms. Since the code is PHP, you could also be using the superglobal array $_ENV{"DOCUMENT_ROOT"} instead. Since this doesn't (theoretically) rely on the underlying operating system call, you might get what you are looking for.
You could also change the code to "reasonableness" check the $_ENV{"DOCUMENT_ROOT"} variable's last character and make sure it's a "/".