PHP In The cPanel Interface
For cPanel & WHM 11.30 and older
As of cPanel & WHM 11.30, we have refactored this system so that it applies to an expanding list of scripting languages. You should review the LiveAPI documentation
for the most recent information.
cPanel allows for additional pages to be written in PHP rather than HTML. This provides full access to our APIs via our API tags
To use cPanel PHP, place a PHP script anywhere inside of the following directory:
This directory corresponds to the following URL:
If you place a PHP script outside of this directory, the source code will be exposed.
cPanel tags are still available by using <cpanel>
tags. These tags can be executed before or after the PHP script. The order of execution is determined by the file extension used:
.php — Executes cPanel tags before the PHP code.
.cpphp — Executes cPanel tags before the PHP code.
.phpcp — Executes the PHP code followed by the cPanel tags.
cPanel PHP files should never use the short opening tag for PHP. Instead, you should use
cPanel PHP functions
The following cPanel-specific PHP functions are available:
| This function loads information about your server and the cPanel account's settings.
| This function loads information about the account's parked domains.
| This function loads information about the account's subdomains.
| This function loads information about the account's document root.
The cPanel PHP functions use the following syntax:
Much of the same information provided by the cPanel PHP functions can be obtained through the DomainLookup API2 Module
A demonstration PHP page is available in the following location:
This page corresponds to the following URL:
The page demonstrates POST
input types at the top of the page, and the four cPanel previously-listed PHP functions.
This system is provided by a custom PHP binary that is located in one of the following directories:
for cPanel PHP is available at:
cPanel recommends that you do not change this PHP binary, and we will not support any changes made to it.