How to Edit Your php.ini File on cPanel

On systems that run EasyApache 3, the /usr/local/lib/ directory contains your server’s php.ini file.
On systems that run EasyApache 4, multiple php.ini and local.ini files manage your system’s PHP. Each version of PHP on your systems uses its own php.ini and local.ini file. You must make changes to each file separately.

On systems that run EasyApache 3, we strongly recommend that you only edit this file with WHM’s PHP Configuration Editor interface (Home >> Service Configuration >> PHP Configuration Editor).

On systems that run EasyApache 4, we strongly recommend that you only edit these files with WHM’s MultiPHP INI Editor interface (Home >> Software >> MultiPHP INI Editor). This ensures that an operable version of PHP exists on the system.


Install xcache

CentOS 6

# yum install php-xcache xcache-admin

Debian/Ubuntu/Linux Mint

# apt-get install php5-xcache



# nano /etc/php.d/xcache.ini

Debian/Ubuntu/Linux Mint

# nano /etc/php5/conf.d/xcache.ini


# nano /etc/php5/mods-available/xcache.ini

once you’re done with configuration settings, restart your Apache web server.

# /etc/init.d/httpd restart

# /etc/init.d/apache2 restart


# php -v

Enabling XCache Admin Panel for PHP

By default the admin panel is protected with http-auth and in disabled state. To set user/password open the Xcache.ini file. But, first you have to create md5 password using following command. (Where typeyourpassword is your password).

# echo -n "typeyourpassword" | md5sum

Sample Output


Now open Xcache.ini file add the generated md5 password. See the following example, add your own password md5 string.

xcache.admin.enable_auth = On
; Configure this to use admin pages
xcache.admin.user = "mOo"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = "ae9ac3f19ae3990b2c99701061c5d8c2"

The simplest way to do so is copying the whole directory xcache (admin was in older release) to your web root directory (i.e. /var/www/html or /var/www).

# cp -a /usr/share/xcache/ /var/www/html/


# cp -a /usr/share/xcache/htdocs /var/www/xcache


cp -a /usr/share/xcache/admin/ /var/www/ (older release)

Now call it from your browser, a http-auth login prompt window will pop-up. Enter your user/pass in, and it’s done.

http://localhost/xcache OR http://localhost/admin (older release)

Downgrade PHP 7 to PHP 5.6 on Ubuntu 16.04 Xenial

How to install PHP 5.6 on Ubuntu 16.04 Xenial and replace php 7. Let’s assume you have a fresh Ubuntu 16.04 server.

Install add-apt-repository:

# sudo apt-get install python-software-properties

Add repository for PHP 5.6:

# sudo add-apt-repository -y ppa:ondrej/php

Update package lists:

sudo apt-get update

Install php5-fpm:

# sudo apt-get install php5.6-fpm

Check the result:

# php -v
PHP 7.0.4-7ubuntu2.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

Run the following:

# sudo mv /usr/bin/php /usr/bin/php7
# sudo mv /usr/bin/php5.6 /usr/bin/php

Check again

# php -v
PHP (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Restart Apache

# service apache2 restart

APC on Cpanel

Install APCu. APC is not supported after php 5.4

Edit php.ini

; APC Configuration
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 128M
apc.max_file_size = 2M
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 1024
apc.enable_cli = 1

Restart apache

Install Apache, Mysql and PHP on Ubuntu 14.04

How to install Apache, MySQL and PHP on Ubuntu 14.04


# sudo apt-get update


# sudo apt-get install apache2

Install MySQL

# sudo apt-get install mysql-server php5-mysql
# sudo mysql_install_db
# mysql_secure_installation

Install PHP

# sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Restart Server

# sudo /etc/init.d/apache2 restart

Check Apache

Open a web browser and navigate to http://IPADDRESS. You should see a message saying It works!

Check PHP

# php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'

Php 4 on cpanel

Here are a few articles that mention it:

How to switch to a different PHP version?

You can set the handler for the site using a .htaccess file in the domains webroot with the following contents:
AddHandler application/x-httpd-php4 .php .php4 .php3



Clone this repository into /var/cpanel/easy/apache/custom_opt_mods/ like so:

# cd /var/cpanel/easy/apache/custom_opt_mods/
# git clone .
# /scripts/easyapache

Git on cpanel is at

# /usr/local/cpanel/3rdparty/bin/git

Or use the .zip:

# cd /usr/src
# wget
# unzip -d /var/cpanel/easy/apache/custom_opt_mods/
# /scripts/easyapache

Make sure that the path is

/var/cpanel/easy/apache/custom_opt_mods]# ls -la

drwxr-xr-x 4 root root  4096 Sep  2 20:26 ./
drwxr-xr-x 9 root root  4096 Sep  2 20:38 ../
drwxr-xr-x 3 root root  4096 Sep  2 20:26 Cpanel/
-rw-r--r-- 1 root root   606 Sep  2 20:32 error_log
drwxr-xr-x 7 root root  4096 Sep  2 20:26 .git/
-rw-r--r-- 1 root root 18025 Sep  2 20:26 LICENSE
-rw-r--r-- 1 root root   834 Sep  2 20:26

Or it will not show up in easy apache.

From here, select Phalcon from the list of PHP modules. The module will be loaded from /usr/local/lib/php.ini.

White Screen of Death (WSOD) in php page

You must turn on PHP error reporting. To do this, you should change the setting in your php.ini config file. Temporarily insert the following lines in your index.php file:

ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

Make sure that you have inserted the code directly after the opening PHP tag. The errors should now appear directly on your screen. Alternatively, check your log files for the most recent errors.

Imagemagick on CentOS and Plesk

root@server ~]# yum install ImageMagick
[root@server ~]# yum install ImageMagick-devel

PHP-imagick Installation:
[root@server ~]# yum install gcc
[root@server ~]# yum install make automake
[root@server ~]# yum install php-pear
[root@server ~]# yum install php-devel
[root@server ~]# pecl install imagick

On some servers

yum install php-pecl-imagick.x86_64


convert image.jpg -resize 64x64 resize_image.jpg