Permission denied even with chmod 777
Hello everyone,
i've just setup my first Linux server and installed apache + php. I have a simple PHP script which should just create ja directory. But i always get the following error: PHP Warning: mkdir() [function.mkdir]: Permission denied in /var/www/html/default/test.php on line 3 So as you can see the script is within the folder 'default' which has rights set so 777 Code:
ls -rtl PHP Code:
I've also checked if the httpd process is running with the right user: Code:
ps aux | grep httpd Thus i should be able to create directories via php or not? Why do i get this error even though the permissions are set to 777? best regards Zabrajin |
Hi, welcome to LQ!
Actually your snippet doesn't do anything for me; with a <?php it creates the directory just fine. Cheers, Tink |
Quote:
Still says permission denied :( |
Quote:
|
The permission for the script is as follwing
Quote:
|
it doesn't have execute permission (use 755 thats enough)
|
Changed permission to 755 but still the same error...
|
is SELinux enabled?
|
i'm not sure but i don't think so. It's a VPS with a basic fc10 install. Can i check that somehow?
//edit: I've just run the script as root via the local php interpreter and then everything works fine. Anybody has a clue why it fails when i try it within the webserver? |
PHP safe mode is on?
this just looks extremely stupid to me: it must work under even 0700 with user "apache". copy your phpinfo() outputs. -- upd: try to su to "apache" and cd to that directory then mkdir test there. |
Quote:
Code:
su apache |
Quote:
Code:
$ /usr/sbin/getenforce |
Quote:
If you look at the info in /etc/passwd (if you need to modify don't do it directly, use a program or at least vipw) you will see that the user apache may not have a shell, a home and/or a password which will prevent it from being used as a regular user. You could try to edit in a shell and use the passwd command to give a password and then try what Web suggested (back up your /etc/passwd and /etc/shadow files and restore them after you're done this test). |
...
|
You must have enabled SELinux, trying checking that first.
|
2 Zabrajin: follow advices about SElinux.
2 davidstvz: there's no need to go such a hard way and add password and shell for users that must never have it so take an unnecessary risk. running su -s /bin/sh apache will do the trick safely. |
Quote:
|
Quote:
Quote:
|
Ok i got it ^^ Setting the httpd_sys_script_rw_t context for the default folder fixed it!
Thanks everyone for the hint with SELinux! I didn't know about that and would have searched for ages :) best regards Zabrajin |
I'm having the exact same issue. How did you solve this? I'm running Debian 5.0 on a VPS.
I've done the following: Quote:
Quote:
|
All times are GMT -5. The time now is 09:08 AM. |