SoftwareDevelopmentKit
Software Development Kit
cPanel & WHM's API [+]
cPanel & WHM's API [-]
Basics
Introduction
Authenticating API Function Calls
cPanel Template Toolkit
Internal API
Calling Unified API (UAPI) Functions
Calling API 1 Functions
Calling API 2 Functions
API 1 & 2 Functions via XML API
UAPI Functions
API 1 Functions
API 2 Functions
External API
XML and JSON API
Parsing XML Data
Manage 2 API
API Privilege Escalation
Modules and Plugins [+]
Modules and Plugins [-]
cPanel Modules
Writing cPanel Modules
PHP Accounting Module
cPanel::Accounting Perl Module
Writing cPanel Plugins
Writing cPanel Plugins
PHP in cPanel Plugin Interfaces
cPanel CGI Scripts
Live PHP in cPanel Plugins
Plugin Variables
Installing cPanel Plugins
Adding Icons and Groups
ExpVar Reference (ExpVarRef)
Plugin Installation File Generator
Plugin Security Policy
(
.pdf
)
WHM Plugins
Creating WHM Plugins
ACL Reference Table
The swapip Utility
cPanel Logger Module
Pluggable dnsadmin Modules
EasyApache Modules
Custom Modules
cPanel & WHM Hooks [+]
cPanel & WHM Hooks [-]
Standardized Hooks
Introduction
Taxonomy
Getting Started
Hooks Management Interface
Hookable Events
Advanced Usage
Troubleshooting
Legacy Hooks
Introduction
Writing Function Hooks
Script Hooks
Custom Event Handlers
cPanel Logger Module
Universal Password Trap
Hooking into EasyApache
EasyApache Hooks
cPAddons (Site Software) [+]
cPAddons (Site Software) [-]
Introduction
Create a cPAddon
cPAddon Upgrades
Hash References
Custom Installation Fields
Configuration File Variables
Invisible cPAddon Scripts
cPAddon Aliases
Licensing cPAddons
Distributing cPAddons
System Administration [+]
System Administration [-]
TailWatch
Custom Webmail Applications
Troubleshooting Perl
Developer Software [+]
Developer Software [-]
PHP XML API Class
PublicAPI in PHP
PublicAPI in Perl
API Tracer
Frontend Example
Backend Example
Back to All Documentation
Documentation Home
>
SoftwareDevelopmentKit
E
dit
A
ttach
---+!! PHP In The cPanel Interface *For cPanel & WHM 11.30 and older* %TOC% %X% *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 [[SoftwareDevelopmentKit/LiveAPI][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 [[SoftwareDevelopmentKit/WebHome][API tags]]. ---++ Usage 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: * =<nop>http://www.example.com:2082/frontend/= %X% *Warning:* If you place a PHP script outside of this directory, the source code will be exposed. cPanel tags are still available by using [[SoftwareDevelopmentKit/CallingApiOne][<cpanel>]] and [[SoftwareDevelopmentKit/CallingApiTwo][<?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. %S% *Important:* cPanel PHP files should never use the short opening tag for PHP. Instead, you should use =<?php= ---+++ cPanel PHP functions The following cPanel-specific PHP functions are available: | *Function* | *Description* | | =<strong>loadvars()</strong>= | This function loads information about your server and the cPanel account's settings. | | =<strong>loadparkeddomains()</strong>= | This function loads information about the account's parked domains. | | =<strong>loadsubdomains()</strong>= | This function loads information about the account's subdomains. | | =<strong>loaddocroots()</strong>= | This function loads information about the account's document root. | The cPanel PHP functions use the following syntax: <blockquote><pre><cpanel PHP="loadvars()"></pre></blockquote> Much of the same information provided by the cPanel PHP functions can be obtained through the [[ApiDocs.Api2.ApiDomainLookup][DomainLookup API2 Module]]. ---+++ 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: * =<nop>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: =/usr/local/cpanel/3rdparty/etc= or =/var/cpanel/3rdparty/etc= %X% *Warning:* cPanel recommends that you do not change this PHP binary, and we will not support any changes made to it. <!-- * Set PAGETITLE = PHP In The cPanel Interface -->
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r9
<
r8
<
r7
<
r6
<
r5
|
B
acklinks
|
V
iew topic
|
M
ore topic actions
Topic revision: r9 - 28 Mar 2013 - 16:15:00 - Main.LaurenceSimon
AllDocumentation/AutomationIntegration.CpanelPhp moved from Sandbox.UsingPHPInterface on 30 Sep 2009 - 19:36 by Main.JustinSchaefer
cPanel
cPanel & WHM
®
Website Owner
Hosting Providers
Data Center
System Admins
Developers
Community
News
Blog
Podcast
Videos
Forums
App Catalog
Events
Mailing Lists
Feature Requests
Plans & Pricing
Help
Documentation
English
EspaƱol