ttocskcaj Posted February 19, 2012 Share Posted February 19, 2012 file_get_contents() has suddenly stopped working for me. I keep getting this error: Warning: file_get_contents(/Users/ttocskcaj/MineCMS/public/js/jquery.js ) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in /Users/ttocskcaj/MineCMS/controllers/m.controller.php on line 44 The file(s) definitely exist, I can use nano to open them, and permissions are 777 on all the files. The lampp error log has nothing. Not even a No such file or directory error as you'd expect. Any ideas what's going on? Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/ Share on other sites More sharing options...
jcbones Posted February 19, 2012 Share Posted February 19, 2012 Does your directory structure returned from __FILE__ match up with the directory structure you are passing to file_get_contents? Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/#findComment-1318802 Share on other sites More sharing options...
ttocskcaj Posted February 19, 2012 Author Share Posted February 19, 2012 It does. I am using symlinking on the webserver. But php should follow symlinks right? Apache is. Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/#findComment-1318807 Share on other sites More sharing options...
MMDE Posted February 19, 2012 Share Posted February 19, 2012 It does. I am using symlinking on the webserver. But php should follow symlinks right? Apache is. http://php.net/manual/en/function.getcwd.php Also, what OS? Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/#findComment-1318811 Share on other sites More sharing options...
trq Posted February 19, 2012 Share Posted February 19, 2012 It's pretty obvious what OS, just looking at the path. Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/#findComment-1318820 Share on other sites More sharing options...
ttocskcaj Posted February 19, 2012 Author Share Posted February 19, 2012 It's pretty obvious what OS, just looking at the path. Yea. It's Mac osx. with LAMPP. I'm going to test it on my debian VPS now. I'll post the results... Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/#findComment-1318825 Share on other sites More sharing options...
trq Posted February 19, 2012 Share Posted February 19, 2012 Yea. It's Mac osx. with LAMPP. Hehe, that doesn't make much sense. The L in LAMP stands for Linux. Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/#findComment-1318833 Share on other sites More sharing options...
ttocskcaj Posted February 19, 2012 Author Share Posted February 19, 2012 Well Hehe, that doesn't make much sense. The L in LAMP stands for Linux. Well technically it's XAMPP. But yea. Same difference. That's that the developers call it. Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/#findComment-1318854 Share on other sites More sharing options...
ttocskcaj Posted February 19, 2012 Author Share Posted February 19, 2012 Ok problem solved. The filename (which is read from a txt file) had a "\n" linebreak at the end of it that wasn't showing in the error messages! Just did a str_replace for \n and \r and it's working fine Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/#findComment-1318862 Share on other sites More sharing options...
MMDE Posted February 19, 2012 Share Posted February 19, 2012 Ok problem solved. The filename (which is read from a txt file) had a "\n" linebreak at the end of it that wasn't showing in the error messages! Just did a str_replace for \n and \r and it's working fine That's probably why you should always post your code... Link to comment https://forums.phpfreaks.com/topic/257284-file_get_contents-no-such-file-or-directory/#findComment-1318865 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.