Selecting a PHP Binary
For WHM version 11.38
cpsrvd (cPanel & WHM) needs to know the path to the specific PHP binary that should be used to process PHP scripts such as
phpMyAdmin. There are likely several PHP binaries from which you can choose and several reasons you may want to pick one PHP binary over another.
The usecpphp File
/var/cpanel/usecpphp, when it exists, causes
cpsrvd to use a non-system PHP provided by cPanel. You may want to do this if the version of PHP that you have built for
Apache does not have all of the features required to run inside of
cpsrvd.
This cPanel-provided PHP binary exists on the system as 1 of the 2 following files:
-
/usr/local/cpanel/3rdparty/bin/php
-
/usr/local/cpanel/3rdparty/bin/php-cgi
Note: php-cgi is preferred over
php if both are available and executable.
This particular PHP binary contains all of the necessary options to run inside of
cpsrvd. However, if you experience linking issues or require additional features in the PHP binary that
cpsrvd uses, you will need to build an additional local PHP binary. You can do this by running the following script:
-
/usr/local/cpanel/scripts/makecpphp
This script uses the EasyApache framework to build a PHP configuration that will work with
cpsrvd. This PHP binary will exist as 1 of the following 2 files:
-
/var/cpanel/3rdparty/bin/php
-
/var/cpanel/3rdparty/bin/php-cgi
Note: php-cgi is preferred over
php if both are available and executable.
However, if
/var/cpanel/usecpphp does
not exist, WHM will use the PHP binary
/usr/local/cpanel/3rdparty/bin/php-cgi.
The behavior can be modified in
/var/cpanel/3rdparty/bin/php. If the binary exists, is executable, and
/var/cpanel/usecpphp exists, then
cpsrvd will always use this binary.
Below is a pseudo-logic example for determining which PHP binary
cpsrvd will use.
Note: php-cgi is preferred over
php if both are available and executable.
WHM:
- Does /var/cpanel/usecpphp exist?
- Yes
- Does /var/cpanel/3rdparty/bin/php-cgi exist?
- Yes
- Use /var/cpanel/3rdparty/bin/php-cgi
- No
- Does /var/cpanel/3rdparty/bin/php exist?
- Yes
- Use /var/cpanel/3rdparty/bin/php
- No
- Does /usr/local/cpanel/3rdparty/bin/php-cgi exist?
- Yes
- Use /u/l/c/3rdparty/bin/php-cgi
- No
- Use /u/l/c/3rdparty/bin/php
- No
- Does /usr/local/cpanel/3rdparty/bin/php-cgi exist?
- Yes
- Use /u/l/c/3rdparty/bin/php-cgi
- No
- Use /u/l/c/3rdparty/bin/php
cPanel:
- Request is for phpmyadmin?
- Yes
- Follow logic for WHM
- No
- Does /var/cpanel/usecpphp exist?
- Yes
- Follow logic for WHM
- No
- Does /usr/bin/php-cgi exist?
-Yes
- Use /usr/bin/php-cgi
- No
- Use /usr/bin/php
Webmail:
- Follows WHM logic

*Note:*=/usr/bin/php= is only used if
usecpphp does not exist and the request is for a third party product.
cPanel & WHM PHP binary flowchart