Reply to Re: PHP Filesystem permissions help

Your name:

Reply:


Posted by Martin Adams on 07/21/07 13:49

hmm, seems to work if I have my Apache DocumentRoot pointing to
/var/www/html instead of my /web directory.

Well, I'm still confused why that would make a difference.

Again, any help would be much appreciated.

Thanks.

Martin

"Martin Adams" <php@martin.student-film.com> wrote in message
news:uYnoi.447$QD2.72@newsfe1-gui.ntli.net...
> If someone could help me with this issue, it would be much appreciated.
>
> I'm running Fedora Core 5 which had Apache and PHP 5.1.6 installed. I've
> got it so it can run a PHP script okay. However, it doesn't have any
> access to the file system because it keeps getting a permission denied. I
> can't create directories, write to files, etc.
>
> Now, normally this is just because the current user 'apache' doesn't have
> write permission to the file system. However, I've not only changed the
> recursive directory from my /web root to have 777 full permissions, I've
> also changed the file/directory owner and group to be 'apache' - still
> with no luck.
>
> Any ideas what might be going on?
>
> Here's my script:
>
> $output = shell_exec('whoami');
> echo "<pre>Who Am I: $output</pre>";
>
> $output = shell_exec('groups');
> echo "<pre>Groups: $output</pre>";
>
> $output = shell_exec('ls -l');
> echo "<pre>Directory Listing:<br>$output</pre>";
>
> $fp = fopen('test.dat', 'w');
> fwrite($fp, "this is my data");
> fclose($fp);
>
> if(mkdir('temp3'))
> {
> print('<p>Created temp3</p>');
> }
> else
> {
> print('<p>Could not create temp3</p>');
> }
>
> $output = shell_exec('ls -l');
> echo "<pre>Directory Listing:<br>$output</pre>";
>
> This is the output it generates:
>
> Who Am I: apache
> Groups: apache
> Directory Listing:total 8
> -rwxrwxrwx 1 apache apache 1484 Jul 21 04:31 test.php
>
> Warning: fopen(test.dat) [function.fopen]: failed to open stream:
> Permission denied in /web/webbuild/test.php on line 29
>
> Warning: fwrite(): supplied argument is not a valid stream resource in
> /web/webbuild/test.php on line 30
>
> Warning: fclose(): supplied argument is not a valid stream resource in
> /web/webbuild/test.php on line 31
>
> Warning: mkdir() [function.mkdir]: Permission denied in
> /web/webbuild/test.php on line 33
>
> Could not create temp3
>
> Directory Listing:total 8
> -rwxrwxrwx 1 apache apache 1484 Jul 21 04:31 test.php
>
> Any ideas why it can't write to the filesystem?
>
> Many thanks in advance.
>
> Martin
> php@martin.student-film.com
>
>
>
>

[Back to original 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

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