RE: [PHP] Writing files on Linux
| From: | Michael Geier, CDM Systems Admin | Date: | Fri, 10 Aug 2001 20:43:21 +0000 |
| Subject: | RE: [PHP] Writing files on Linux | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62217@lists.php.net to get a copy of this message | ||
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