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. Link to comment https://forums.phpfreaks.com/topic/256441-fopen-says-unable-to-access-yet-file-exists/ 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. Link to comment https://forums.phpfreaks.com/topic/256441-fopen-says-unable-to-access-yet-file-exists/#findComment-1314666 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. Link to comment https://forums.phpfreaks.com/topic/256441-fopen-says-unable-to-access-yet-file-exists/#findComment-1314674 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?! Link to comment https://forums.phpfreaks.com/topic/256441-fopen-says-unable-to-access-yet-file-exists/#findComment-1314676 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.