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 IamtheEvster on 09/27/07 03:50

On Sep 26, 6:43 pm, The Natural Philosopher <a...@b.c> wrote:
> 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..

Well, If I try to su apache, then I get "The account is currently not
available."

I believe, though, that that's because it's set to be an account that
can't log in. In /etc/passwd, the home directory for the apache
account is /sbin/nologin. If I change that to an actual directory
(one that apache does not have permission to, for example) then I
get:

# su apache
su: /home/otheruser: Permission denied

Even if I try to assign permissions to all or to the apache user, I
get the permission denied error, so not sure what's going on there.


Where in PHP might there be some other permission-related items? Are
there any settings in php.ini I should be looking at?

Thanks again for the help.

Evan

 

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

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