For cPanel & WHM 11.32
This document describes a cPanel subsystem that can allow you to affect a PHP application served from within cPanel, WHM, or webmail.
In cPanel & WHM 11.32, we added the ability to specify two low-level PHP handling attributes when cPanel, WHM, or webmail serves a PHP application. You can choose:
- Which user owns the runtime process
php.ini the PHP binary should utilize
These are useful features when writing an application that, for example, grants database access to a single system user. This new functionality is called AppConfig and requires a simple configuration file to work.
The configuration file must:
- Exist in
- Note: This directory does not exist by default on your system. If no other AppConfig files exist, you will need to create this directory.
- Use the
.conf file extension.
- Contain at least 2 of the following 4 key/value pairs.
|| The URL path to the application to run.
|| The service in which the URL is served. This value must be either
webmail. If your application is used in more than one service, you will need to create configuration files for each service. This key may only contain one value.
|| The user who will run the application.
php.ini file the application should use.
is the path to the application you wish to run. In order for your application to be compatible with AppConfig, it must exist in
. Only applications in
are accessible to AppConfig.
For example, specifying
will run an application called
key specifies the service (cPanel, WHM, or webmail) in which the URL is served. This key must contain one of three values:
. If your application is used in more than one service, you will need to create configuration files for each service. This key may only contain one value.
This value should contain the user that will run the application. This user must exist on the system but should not
be a cPanel user. As a best practice, we strongly recommend prefixing your username with
. This will denote that the user is used to run an application inside of cPanel, but is not a cPanel user. The application will not
run as the specified user until cPanel has been restarted. As the
user, you can restart cPanel by running the restart command:
# /etc/init.d/cpanel restart
For example, setting this key's value to
will run the application you specified in
, once cPanel has been restarted.
This key's value should be the path to the
file your application will use. This value must contain the directory inside of
that contains the
file your application will use.
For example, specifying
as this key's value will use the file
to run the application specified in
as the user specified in
The following example will run an application called
file located at
# Service that will serve this app
# Physical path: /usr/local/cpanel/3rdparty/Foo.php
# Literal URL path: $server:$port/$cpsession/3rdparty/Foo.php
# System user to run process as
# Directory containing php.ini
# - must exist in /usr/local/cpanel/3rdparty/etc/
This test application will allow you to test the AppConfig functionality: