Easy Apache 3 & PHP

← Go Back

Common Questions

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.

↑ Back To Top ↑

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.

↑ Back To Top ↑

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_suphp in 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 add suPHP_UserGroup directives to the default Virtual-Hosts in httpd.conf and mod_suphp should 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/htdocs must be configured with the ExecCGI directory option. The standard httpd.conf file shipped with Apache does not have this option set.

↑ Back To Top ↑