Difference: CpanelPhp (1 vs. 9)

Revision 928 Mar 2013 - Main.LaurenceSimon

Line: 1 to 1
 
META TOPICPARENT name="Sandbox.WebHome"
Changed:
<
<

Using PHP in the cPanel Interface

>
>

PHP In The cPanel Interface

 
Changed:
<
<
For cPanel & WHM 11.30 and older versions of cPanel & WHM
>
>
For cPanel & WHM 11.30 and older
 
Changed:
<
<
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 our LiveAPI documentation for the most recent information.
>
>

ALERT! Warning: 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.

Overview

  cPanel allows for additional pages to be written in PHP rather than HTML. This provides full access to our APIs via our API tags.

Usage

To use cPanel PHP, place a PHP script anywhere inside of the following directory:

Changed:
<
<
  • /usr/local/cpanel/base/frontend/
>
>
/usr/local/cpanel/base/frontend/
  This directory corresponds to the following URL:
Added:
>
>
  • http://www.example.com:2082/frontend/
 
Changed:
<
<
  • http://www.example.com:2082/frontend/

ALERT! Warning: Placing the script outside of this directory will cause the source code to be exposed.

>
>
ALERT! Warning: If you place a PHP script outside of this directory, the source code will be exposed.
  cPanel tags are still available by using <cpanel> and <?cp> tags. These tags can be executed before or after the PHP script. The order of execution is determined by the file extension used:
Changed:
<
<
  • .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.
>
>
  • .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.
 
Changed:
<
<
PICK Important: cPanel PHP files should never use the short opening tag for PHP, <?php should be used instead.
>
>
PICK Important: cPanel PHP files should never use the short opening tag for PHP. Instead, you should use <?php
 
Changed:
<
<

System Information

>
>

cPanel PHP functions

The following cPanel-specific PHP functions are available:

Function Description
loadvars() This function loads information about your server and the cPanel account's settings.
loadparkeddomains() This function loads information about the account's parked domains.
loadsubdomains() This function loads information about the account's subdomains.
loaddocroots() This function loads information about the account's document root.

The cPanel PHP functions use the following syntax:

 
Changed:
<
<
This system is provided by a custom PHP binary located in 1 of the following 2 directories:
>
>
<cpanel PHP="loadvars()">
 
Changed:
<
<
  • /usr/local/cpanel/3rdparty/bin/php
  • /var/cpanel/3rdparty/bin/php
>
>
Much of the same information provided by the cPanel PHP functions can be obtained through the DomainLookup API2 Module.
 
Changed:
<
<
This PHP binary is not customizable in any way, form, or fashion.
>
>

Example

A demonstration PHP page is available in the following location: /usr/local/cpanel/base/frontend/x3/test.php

This page corresponds to the following URL:

  • http://www.example.com:2082/frontend/x3/test.php

The page demonstrates POST, GET and FILE input types at the top of the page, and the four cPanel previously-listed PHP functions.

System Information

This system is provided by a custom PHP binary that is located in one of the following directories:

  • /usr/local/cpanel/3rdparty/bin/php
  • /var/cpanel/3rdparty/bin/php
  php.ini for cPanel PHP is available at:
Changed:
<
<
  • /usr/local/cpanel/3rdparty/etc or /var/cpanel/3rdparty/etc
>
>
/usr/local/cpanel/3rdparty/etc or /var/cpanel/3rdparty/etc

ALERT! Warning: cPanel recommends that you do not change this PHP binary, and we will not support any changes made to it.

 

META TOPICMOVED by="JustinSchaefer" date="1254339381" from="Sandbox.UsingPHPInterface" to="AllDocumentation/AutomationIntegration.CpanelPhp"

Revision 830 Nov 2011 - Main.JustinSchaefer

Line: 1 to 1
 
META TOPICPARENT name="Sandbox.WebHome"

Using PHP in the cPanel Interface

Changed:
<
<
cPanel allows for additional pages to be written in PHP rather than straight HTML. This provides full access to our APIs via our API tags.
>
>
For cPanel & WHM 11.30 and older versions of cPanel & WHM

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 our 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.

 

Usage

Line: 36 to 40
 php.ini for cPanel PHP is available at:
  • /usr/local/cpanel/3rdparty/etc or /var/cpanel/3rdparty/etc
Added:
>
>
<-- 
  • Set PAGETITLE = Using PHP in the cPanel Interface
-->
 
META TOPICMOVED by="JustinSchaefer" date="1254339381" from="Sandbox.UsingPHPInterface" to="AllDocumentation/AutomationIntegration.CpanelPhp"

Revision 717 Aug 2011 - Main.JustinSchaefer

Line: 1 to 1
 
META TOPICPARENT name="Sandbox.WebHome"

Using PHP in the cPanel Interface

Changed:
<
<
cPanel allows for additional pages to be written in PHP rather than straight HTML. This provides full access to our APIs via our API tags.
>
>
cPanel allows for additional pages to be written in PHP rather than straight HTML. This provides full access to our APIs via our API tags.
 

Usage

Line: 16 to 16
  ALERT! Warning: Placing the script outside of this directory will cause the source code to be exposed.
Changed:
<
<
cPanel tags are still available by using <cpanel> and <?cp> tags. These tags can be executed before or after the PHP script. The order of execution is determined by the file extension used:
>
>
cPanel tags are still available by using <cpanel> and <?cp> 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

Revision 619 Feb 2011 - Main.JustinSchaefer

Line: 1 to 1
 
META TOPICPARENT name="Sandbox.WebHome"

Using PHP in the cPanel Interface

Changed:
<
<
cPanel allows for additional pages to be written in PHP rather than straight HTML. This provides full access to our APIs via our API tags.
>
>
cPanel allows for additional pages to be written in PHP rather than straight HTML. This provides full access to our APIs via our API tags.
 

Usage

Line: 16 to 16
  ALERT! Warning: Placing the script outside of this directory will cause the source code to be exposed.
Changed:
<
<
cPanel tags are still available by using <cpanel> and <?cp> tags. These tags can be executed before or after the PHP script. The order of execution is determined by the file extension used:
>
>
cPanel tags are still available by using <cpanel> and <?cp> 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

Revision 510 Aug 2010 - AyeMaung

Line: 1 to 1
 
META TOPICPARENT name="Sandbox.WebHome"

Using PHP in the cPanel Interface

Revision 430 Sep 2009 - Main.JustinSchaefer

Line: 1 to 1
Changed:
<
<
META TOPICPARENT name="WebHome"
>
>
META TOPICPARENT name="Sandbox.WebHome"
 

Using PHP in the cPanel Interface

Changed:
<
<

cPanel allows for additional pages to be written in PHP rather than straight HTML. This provides full access to our APIs via our DeveloperResources/ApiBasics/WebHome][API tags]].
>
>
cPanel allows for additional pages to be written in PHP rather than straight HTML. This provides full access to our APIs via our API tags.
 

Usage

Line: 35 to 35
  php.ini for cPanel PHP is available at:
  • /usr/local/cpanel/3rdparty/etc or /var/cpanel/3rdparty/etc
Added:
>
>
META TOPICMOVED by="JustinSchaefer" date="1254339381" from="Sandbox.UsingPHPInterface" to="AllDocumentation/AutomationIntegration.CpanelPhp"

Revision 329 Sep 2009 - Main.JustinSchaefer

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Using PHP in the cPanel Interface

Line: 16 to 16
  ALERT! Warning: Placing the script outside of this directory will cause the source code to be exposed.
Changed:
<
<
cPanel tags are still available by using and <?cp> tags. These tags can be executed before or after the PHP script. The order of execution is determined by the file extension used:
>
>
cPanel tags are still available by using <cpanel> and <?cp> 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.
Changed:
<
<
Important: cPanel PHP files should never use the short opening tag for php, <?php should be used instead.
>
>
PICK Important: cPanel PHP files should never use the short opening tag for PHP, <?php should be used instead.
 

System Information

Changed:
<
<
This system is provided by a custom PHP binary located either at /usr/local/cpanel/3rdparty/bin/php or /var/cpanel/3rdparty/bin/php. This PHP binary is not customizable in any way form or fashion. The php.ini for cpanel php is available at /usr/local/cpanel/3rdparty/etc or /var/cpanel/3rdparty/etc
>
>
This system is provided by a custom PHP binary located in 1 of the following 2 directories:

  • /usr/local/cpanel/3rdparty/bin/php
  • /var/cpanel/3rdparty/bin/php

This PHP binary is not customizable in any way, form, or fashion.

php.ini for cPanel PHP is available at:

  • /usr/local/cpanel/3rdparty/etc or /var/cpanel/3rdparty/etc

Revision 229 Sep 2009 - Main.MattDees

Line: 1 to 1
 
META TOPICPARENT name="WebHome"

Using PHP in the cPanel Interface

Line: 6 to 6
 

Usage

Changed:
<
<
To use cPanel PHP, place a PHP script anwhere inside of the following directory:
>
>
To use cPanel PHP, place a PHP script anywhere inside of the following directory:
 
  • /usr/local/cpanel/base/frontend/

This directory corresponds to the following URL:

  • http://www.example.com:2082/frontend/
Deleted:
<
<
    • PICK Remember: You will need to replace example.com in the example above with your domain.
 
Changed:
<
<
ALERT! Warning: Placing the script outside of this directory will cuase the source code to be exposed.
>
>
ALERT! Warning: Placing the script outside of this directory will cause the source code to be exposed.
 
Changed:
<
<
cPanel tags are still available by using and <?cp> tags. These tags can be executed before or after the PHP script. This is denoted by using 1 of the 2 following extensions:
>
>
cPanel tags are still available by using and <?cp> tags. These tags can be executed before or after the PHP script. The order of execution is determined by the file extension used:
 
Added:
>
>
  • .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.

Revision 129 Sep 2009 - Main.JustinSchaefer

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"

Using PHP in the cPanel Interface


cPanel allows for additional pages to be written in PHP rather than straight HTML. This provides full access to our APIs via our DeveloperResources/ApiBasics/WebHome][API tags]].

Usage

To use cPanel PHP, place a PHP script anwhere inside of the following directory:

  • /usr/local/cpanel/base/frontend/

This directory corresponds to the following URL:

  • http://www.example.com:2082/frontend/
    • PICK Remember: You will need to replace example.com in the example above with your domain.

ALERT! Warning: Placing the script outside of this directory will cuase the source code to be exposed.

cPanel tags are still available by using and <?cp> tags. These tags can be executed before or after the PHP script. This is denoted by using 1 of the 2 following extensions:

  • .cpphp — Executes cPanel tags before the PHP code
  • .phpcp — Executes the PHP code followed by the cPanel tags.

Important: cPanel PHP files should never use the short opening tag for php, <?php should be used instead.

System Information

This system is provided by a custom PHP binary located either at /usr/local/cpanel/3rdparty/bin/php or /var/cpanel/3rdparty/bin/php. This PHP binary is not customizable in any way form or fashion. The php.ini for cpanel php is available at /usr/local/cpanel/3rdparty/etc or /var/cpanel/3rdparty/etc