Forum Moderators: coopster

Message Too Old, No Replies

Really perplexing problem with writing to files on server

         

phpmaven

12:21 am on Aug 22, 2015 (gmt 0)

10+ Year Member



I have following lines of code:
$handle = fopen("/usr/local/www/logs/test.log", "a");
fwrite($handle, "this is a test");
fclose($handle);

I have an Apache server with several virtual hosts running. One virtual host can run this code with no problem and the file gets created and written to. The same exact code fails on a different virtual host with "Warning: fopen(/usr/local/www/logs/test.log): failed to open stream: No such file or directory in..."

I'm totally baffled as to what the problem could be.

Thanks,

Mark

lucy24

4:34 am on Aug 22, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



From the Apache side:
Is each of the <VirtualHost> envelopes exactly, precisely identical, in every way, backward forward and sideways? Is the physical directory structure identical? (Not inside the various hosts, of course, just the directories you have to go through to get there.) Crystal ball says the solution will involve "But, but how could that possibly have had anything whatsoever to do with the problem?"

whitespace

9:55 am on Aug 22, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



From the PHP side:
Directory does not exist, directory permissions / ownership error? OPEN_BASEDIR restriction?

phpmaven

9:12 pm on Aug 22, 2015 (gmt 0)

10+ Year Member



Thanks for the suggestions. Turns out that I'm an idiot. ;-)

eeek

6:06 pm on Sep 17, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Directory does not exist, directory permissions / ownership error? OPEN_BASEDIR restriction?


And is selinux involved?