Quantcast
Image

Search Results for: check-version

How to change PHP version in cPanel hosting

By  •  November 28, 2023

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

How to use PHP 7 in cPanel hosting

By  •  May 28, 2018

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;

  1. Go to the Software section and click on Select PHP Version.
  2. Here you’ll see the PHP version used for your cPanel hosting. Click on the select box, and choose 7.0 or whatever latest version of PHP version available.
  3. Click Set as current for the changes to be effective, and notice Current PHP version in the example is now 7.0.
  4. Check your current PHP version to confirm.

How to check installed PHP version

By  •  May 28, 2018

Here are some ways that you can check the installed version of PHP in your system;

  1. Run 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
  2. Run php -i from the command line.

    $ php -i | grep "PHP Version"
    PHP Version => 7.0.19
    PHP Version => 7.0.19
  3. Print PHP_VERSION_ID from PHP script.

    <?php 
    echo PHP_VERSION_ID;
    //Sample output: 70019
    ?>
  4. Print phpversion() output from PHP script.

    <?php 
    echo phpversion();
    //Sample output: 7.0.19
    ?>
  5. View from phpinfo() output

    <?php 
    phpinfo();
    ?>

  6. Query your package manager where the 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
Top