Easy Apache 3 & PHP
← Go BackCommon Questions
- Question: What permissions do my PHP scripts need?
- Question: I changed the PHP configuration, but PHP doesn't seem to be working properly.
- Question: How do I get PHP working in
/usr/local/apache/htdocs?
What permissions do my PHP scripts need?
As mentioned in the previous section, all of the PHP configurations supported by cPanel require appropriate read access the the script. If the "nobody" user will be executing it, the "nobody" user much be capable of reading it. Generally speaking, this means 0644 permissions should be adequate for all setups.
I changed the PHP configuration, but PHP doesn't seem to be working properly.
First, perform a HARD restart of Apache. If that doesn't fix the problem,
verify that the "Include /usr/local/apache/conf/php.conf" directive
is in httpd.conf
If that is okay, check the error log for obvious problems.
If nothing particularly revealing is in the logs, check the .htaccess files in all directories leading to the script for bad AddHandler directives.
How do I get PHP working in /usr/local/apache/htdocs?
The answer to this question depends largely on how PHP is being handled.
- DSO
- Should work by default without any tweaking.
- SuPHP
- Versions of cPanel/WHM before revision 19254 did not add the directives required to run PHP
scripts using
mod_suphpin the main apache document root. To fix this issue, update cPanel, run "/usr/local/cpanel/bin/apache_conf_distiller --update --main" and "/scripts/rebuildhttpdconf". This should addsuPHP_UserGroupdirectives to the default Virtual-Hosts inhttpd.confandmod_suphpshould begin serving PHP requests directed at those hosts. PHP scripts will must be owned by the "nobody" user and group. - CGI/FCGID
- These should work by default, but
/usr/local/apache/htdocsmust be configured with the ExecCGI directory option. The standardhttpd.conffile shipped with Apache does not have this option set.
