[thelist] php - cannot open or write to a file

Bob Meetin bobm at dottedi.biz
Sun Jul 19 16:01:35 CDT 2009

$file = "/var/www/some_username/httpdocs/survey.csv";  // the path is 

if (! file_exists( $file )) { $doit = fopen("$file", "w"); }

$fp = fopen("$file", "a+");

$label = "some text"

fwrite($fp, "$label|");

fwrite($fp, "XXXXXXXXXXXXXXXXXXXXX");  // just to see...

Thhe above looks to me that it should work, however of course it doesn't 
so I tried a couple things like the following in the PHP script:

system ("touch $file"); // it just stares back at me

So I ftp a one liner file to the website and:

chmod ("$file", 0666); // this does nothing to update perms

system ("ls -l $file"); // this lists the file and perms

system ("chmod 666 $file"); // this also does nothing

I'm thinking this must be a probelm with how the "UNIX/Linux" webserver 
is set up, so I ftp a phpinfo() file to the server What would they have 
done with apache/php.ini to prevent file creation, and if so what should 
I be looking for?


More information about the thelist mailing list