You are here: Re: fopen permissions problem - PHP5 and RHEL4 « PHP Programming Language « IT news, forums, messages
Re: fopen permissions problem - PHP5 and RHEL4

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..

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация