Sunday, December 16, 2012

Can't execute script php in httpd

hello, now I will try to give you a tutorial how to cope with the php script is not executed by httpd. how easy to follow this below:

Some linux distros (especially those based on RHEL such as CentOS or Fedora) comes with SELinux enabled by default. This can be checked, and for a change, with the following command:

- Sudo / usr / sbin / getenforce
it will display information

- Sudo / usr / sbin / setenforce Permissive
- / Usr / sbin / getenforce
it will display the Permissive

You can see the current configuration, how
- Sudo / usr / sbin / sestatus

I was in the operating system:
SELinux status: enabled
SELinuxfs mount: / sys / fs / selinux
SELinux root directory: / etc / selinux /
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
MLS Policy status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28

This change can be made ​​permanent by editing the / etc / selinux / config file and set the variable SELinux to permissive or disabled.

But, the correct way to solve this kind of issue, if you are indeed in this situation, is to check the / var / log / audit / audit.log log file. It will Contain all the events related to SELinux rules. You'll then probably your script should give the correct context, ie being authorized to be run by the apache / php user. Checking SELinux security context is done with ls-Z:

- ls- alZ / var / www / cgi-bin /
drwxr-xr-x. root root system_u: object_r: httpd_sys_script_exec_t: s0.
drwxr-xr-x. root root system_u: object_r: httpd_sys_content_t: s0 ..

good luck and hopefully useful.

No comments:

Post a Comment