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

Jon Molesa rjmolesa at consoltec.net
Sun Jul 19 22:45:05 CDT 2009


Good, ignore my first reply.

*On Sun, Jul 19, 2009 at 06:34:00PM -0600 Bob Meetin <bobm at dottedi.biz> wrote:

> Date: Sun, 19 Jul 2009 18:34:00 -0600
> From: Bob Meetin <bobm at dottedi.biz>
> Subject: Re: [thelist] php - cannot open or write to a file - solved
> To: "thelist at lists.evolt.org" <thelist at lists.evolt.org>
> 
> Dave Stevens wrote:
> > Maybe the directory doesn't have wrote permissions?
> >
> > Sent from my iPhone
> >
> > On 19 Jul 2009, at 17:01, Bob Meetin <bobm at dottedi.biz> wrote:
> >
> >> $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?
> >>
> >> -- 
> >> Bob0:
> -->> that was a hint, but not the directory;  I forgot that through FTP 
> you can not only look at but change file permissions.  The httpdocs 
> directory is 750:
> 
> drwxr-x---  19 rvcftp   psaserv     12288 Jul 19 11:49 httpdocs
> 
> And the file was what it normally should be, 644, to write to files:
> 
> -rw-r--r--   1 rvcftp   psacln        816 Jul 19 17:26 survey.csv
> 
> On a hunch with your clue I changed it to 666 via FTP and it works!
> 
> -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