To avoid problems, you might want to compute the absolute location of your /static directory - try using $_SERVER['DOCUMENT_ROOT'] to do this, then use that.
Using relative paths for filenames for IO is a bit iffy, as I'm never 100% sure how PHP handles it, for example, in a multithreaded web server where multiple PHP threads might share a current working directory.
Mark