RE: [PHP] Writing files on Linux
| From: | Corin Rathbone | Date: | Fri, 10 Aug 2001 21:56:37 +0000 |
| Subject: | RE: [PHP] Writing files on Linux | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62224@lists.php.net to get a copy of this message | ||
I have chmod 777 the file using exec(). The permissions have changed, yet
the problem still there.
The dies were added afterwards to debug it, as before the page it was called
from printed that an error had occured from the returned $worked.
It is owned by nobody in the group nobody.
It is strange as it works fine on Win98.
-----Original Message-----
From: Michael Geier, CDM Systems Admin [mailto:mgeier@cdmsports.com]
Sent: 10 August 2001 21:43
To: Corin Rathbone
Cc: php-general@lists.php.net
Subject: RE: [PHP] Writing files on Linux
there really is no reason to "return $worked" since the script will "die" on
any problems.
chmod 777 /var/www/htdocs/$file for one pass of the script to see if it is a
permissions issue.
file either needs to be 'chmod a+w' or owned by the user the script is
running as.
-----Original Message-----
From: Daniel Adams [mailto:danno@wpi.edu]
Sent: Friday, August 10, 2001 3:31 PM
To: Corin Rathbone
Cc: php-general@lists.php.net
Subject: Re: [PHP] Writing files on Linux
What error does it give you? Is it a permissions issue?
- Dan
On Fri, 10 Aug 2001, Corin Rathbone wrote:
> Does anybody know why the function below does not work on Linux yet works
> perfectly well on windows.
>
> function write_file($file, $contents){ // $contents is like "Test,
Test"
> global $root_path; // $root_path is /var/www/htdocs
> $file_location = $root_path.$file; // $file is /jim.txt
> $fp = fopen("$file_location", "w") or die("Could not open file
pointer.");
> $worked = fwrite($fp, $contents) or die("Could not write to file
pinter");
> // It fails here
> fclose($fp) or die("Could not close file pointer");
> return $worked;
> }
>
> It always fails at fwrite.
>
> Thanks,
> Corin Rathbone
>
>
>
--
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net