MaxG Posted February 5, 2012 Share Posted February 5, 2012 I run a dev site locally on Windows and the real site on a hosting provider on LINUX. PHP5, XAMP, etc. Locally my fopen works. On the web server it throws an error: "Warning: fopen() [function.fopen]: Unable to access" filepath/name The file exists on both servers; upper/lower case is correct; so are access rights. I noticed the error only today; this was working for the last 7 months; the function serves a range of content-types; just tested XLS and it works. Now I am stuck This line throws the error: $handle = fopen($strPathFileName, 'rb'); $strPathFileName uses / only Any pointers appreciated... thanks. Quote Link to comment Share on other sites More sharing options...
scootstah Posted February 5, 2012 Share Posted February 5, 2012 Sounds like file permission problems. Try running a "if (file_exists($strPathFileName))" and see if it returns true. Quote Link to comment Share on other sites More sharing options...
MaxG Posted February 5, 2012 Author Share Posted February 5, 2012 thanks! I get FALSE I have compared paths: Unable to access /var/www/vhosts/domain.net/subdomains/www.name/httpdocs/resources/Music/MIDIs/Hermann/Hermann13.zip ... and actually echoing the $strPathFileName -- and they match. What puzzles me is that XLS, PDF and MP3 files are served nicely by my code. Not so ZIP; yet the content-type = application/zip I have just uploaded the table with the file details; just in case they are corrupt -- same problem. Quote Link to comment Share on other sites More sharing options...
MaxG Posted February 5, 2012 Author Share Posted February 5, 2012 Problem solved! The ZIP files seemed to be corrupt; FTP-ing them over the existing ones and it worked. Thanks for the file_exists(); how could I forget?! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.