0

I have a simple script that outputs Permission denied warning in the browser:

rename('/opt/web/test.tmp', '/opt/web/test.tmp1')

Script path is /opt/web/test_rename.php

/opt/, /opt/web/ and /opt/web/test_rename.php are 777 and have apache owner / group.

httpd process owner is apache

test.tmp is 777 and have apache owner as well

It works fine with cli.

What else could I do to make it work via apache?

Dmitry
  • 729
  • 7
  • 19

1 Answers1

0

The problem was with SELinux. It can block php rename function.

I've found the answer here: http://forums.fedoraforum.org/archive/index.php/t-111081.html

On the Fedora Core 3 Linux distribution, you may get a "failed to open stream: Permission denied in ..." message. In fact changing the permission of the directory will not work (even if you set to 0777).

It is because of the new SELinux kernel that allow apache user to write only in /tmp dir (I think). In order to solve the problem you must to disable the SELinux (at least for apache service) to allow the server to write in other directories. To do that, run the system-config-securitylevel app and disable the SE to apache service. Reboot your system and continue your work.

Dmitry
  • 729
  • 7
  • 19