|
Posted by The Natural Philosopher on 09/26/07 22:43
IamtheEvster wrote:
> Hi there,
>
> I'm using fopen for the first time and I know I'm running into a
> permissions problem, but I can't seem to resolve it and any help would
> be greatly appreciated.
>
> I'm running PHP5 and Apache on RedHat Enterprise Linux 4.
>
> I've verified (by looking in httpd.conf) that Apache is running as
> user "apache" and group "apache". So, that's the user/group that PHP
> should be running under, right?
>
> The following line of code in my PHP file which, as I understand,
> should open a pointer to a file, and create the file if it doesn't
> exist (which it doesn't):
> $writeFile = fopen($directory . $filename, "w");
>
> This generates the following error:
> Warning: fopen(/home/chroot/exports/webleads_200709261803.csv)
> [function.fopen]: failed to open stream: Permission denied in /path/to/
> filename.php on line 87
>
> I've tried changing ownership of the /home/chroot/exports/ directory
> to have the group be "apache" and then done a chmod 775 on the
> directory. Still get the error.
>
> In fact, if I chmod 777 on the directory, thus giving every user
> permission to write to the dir, I still get the error. I totally
> don't understand that...
>
> Any help would be greatly appreciated. I'm really at my wits end at
> this point.
>
> Thanks,
>
> Evan
>
well it seems weird.
Try (as root) going
# su apache
$ touch "pathtofilename"
and see if that works.
If it does, I suspect PHP itself has some permssion stuff getting in the
way. There I can't help..
[Back to original message]
|