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

Jon Molesa rjmolesa at consoltec.net
Sun Jul 19 22:43:58 CDT 2009


*On Sun, Jul 19, 2009 at 03:01:35PM -0600 Bob Meetin <bobm at dottedi.biz> wrote:

> Date: Sun, 19 Jul 2009 15:01:35 -0600
> From: Bob Meetin <bobm at dottedi.biz>
> Subject: [thelist] php - cannot open or write to a file
> To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
> 
> $file = "/var/www/some_username/httpdocs/survey.csv";  // the path is 
> accurate
> 
> 
> 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?

Is the script owned by the same user:group as the working directory?

> 
> -- 
> Bob
> 
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 

-- 
Jon Molesa
rjmolesa at consoltec.net
if you're bored or curious
http://rjmolesa.com


More information about the thelist mailing list