Cpanel Apache options related to PHP
Apache options that directly affect how PHP is served.
* CGI (mod_cgi) — This module is required for Apache to execute CGI scripts. Leave this option enabled. Disabling it will prevent mod_cgi from serving PHP pages.
* CGID (mod_cgid) — This module is only available for Apache 2.x and is required as a replacement for mod_cgi when using threaded MPMs. If you wish to use a threaded MPM, make sure this module is enabled.
* Mod FCGID — This module is only available with Apache 2.x and allows Apache to create and manage FastCGI server processes that remain in memory between HTTP requests. Because any binary capable of using the FastCGI protocol can be managed using this module, you can enable mod_fcgid independently of FastCGI support in PHP. This would, for instance, allow you to serve Ruby via FastCGI.
Referemce : FastCGI documentation - http://www.fastcgi.com/drupal/node/6
Choosing which main PHP version to build
Though it is possible to enable both PHP 4 and PHP 5, Cpanel recommend only enabling one version of PHP. This is because when only one version is installed, the binaries are configured in such a way to mirror EasyApache’s installation, simplifying configuration and management.
A CGI binary is installed in /usr/bin/php.
A CLI binary is installed in /usr/local/bin/php
.
When both PHP 4 and PHP 5 are enabled, PHP 5 is installed in the standard locations, listed above, while:
A CGI binary for PHP 4 is installed in /usr/php4/bin/php.
A CLI binary for PHP 4 is installed in /usr/local/php4/bin/php.
Pls Note: PHP 4 is no longer supported by its developers. WCpanel strongly recommend you use PHP 5.
Standard PHP extensions
EasyApache has the ability to install, uninstall, and update several popular PHP extensions as part of the build process. When EasyApache runs, it will automatically determine which extensions are active in the main php.ini file at /usr/local/lib/php.ini.
Active extensions will automatically be selected in the EasyApache interface.
Rerunning EasyApache is not required in order to enable or disable the standard PHP extensions. cPanel now provides a tool called
/scripts/phpextensionmgr that can also be used for the installation or removal of PHP extensions.
For detailed information about this tool, run the following command:
/scripts/phpextensionmgr –help
Changed PHP configuration, but doesn’t seem to be working.
To resolved this issue.
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 enable error logging for PHP scripts which helps in debugging application?
PHP errors are by default logged to the web server’s error log file (at least they are with the default setup on most Linux distros) but it is also possible to instead log PHP errors to a file of your choice. This is useful on production websites so you can periodically check for errors and fix them in a location other than the default webserver error log file.
If you do not currently have a php.ini, make one and place it in the same folder(s) as the PHP script(s) that you want to track errors for. You will need to add the following 2 lines:
log_errors = On
error_log = error_log
If we choose to enable error logging, then we MUST check the error_log often and take corrective actions for persistent errors, it’s recommend having it disabled for security reasons.