cPanel ships with multiple versions of PHP though the configured version is normally not the latest and greatest. PHP 5, for example, was the default version when PHP 7 …
Read More
cPanel
ships with PHP 7
, but PHP 5
is still used by default instead. Even if you don’t use PHP 7
specific functions, the performance benefit that PHP 7
brings is a good enough reason to switch. This is especially important in shared hosting such as cPanel
as performance is especially lacking.
Make sure your application is compatible with PHP 7
before making the switch.
To start using PHP 7
within your cPanel
hosting, log in to cPanel
and follow these steps;
PHP
version to confirm.
Here are some ways that you can check the installed version of PHP
in your system;
php -v
from the command line.
$ php -v PHP 7.0.19 (cli) (built: Jun 21 2017 07:13:57) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
php -i
from the command line.
$ php -i | grep "PHP Version" PHP Version => 7.0.19 PHP Version => 7.0.19
PHP_VERSION_ID
from PHP script.
<?php echo PHP_VERSION_ID; //Sample output: 70019 ?>
phpversion()
output from PHP script.
<?php echo phpversion(); //Sample output: 7.0.19 ?>
PHP
packages are installed from. Here’s a list of some common package managers and the corresponding commands; Platform | Location |
---|---|
homebrew | brew list –versions php |
Debian/Ubuntu | |
RedHat/CentOS |