GUIDE PHP VERSION IN YOUR HOSTING, HOW TO CHANGE IT QUICKLY? 2020 -WAU

Home/Posts/Administración del Hosting/GUIDE PHP VERSION IN YOUR HOSTING, HOW TO CHANGE IT QUICKLY? 2020 -WAU

PHP version in your Hosting

Increasingly, CMS requires the latest versions of PHP to work faster, with greater stability and offering your website a greater performance, but it is not always an easy task to carry out if you are a user who starts out in the world of web projects and Hostings.

Do you know what version of PHP you run on your Hosting?, possibly if, or perhaps you are a little lost when you check it in your Hosting Panel and it tells you one thing and then your website, from the dashboard or the backoffice, tells you another.

Do you want to know how to change your PHP version in your cPanel Hosting Panel with a single click? Well read on because this guide will help you in this process. After trying it you don’t want to be told about codes in .htaccess or complicated server file edits that you possibly don’t even have access to.

Current versions of PHP

Let’s do a quick review of the current status of the supported active PHP versions, so keep in mind that other versions, mainly 5.5 and lower, are not the most recommended for your website to operate normally.

If your website requires a lower version you should analyze if you are using the correct script or the adequate or stable version.

What is the difference between using one or another version of PHP? Well, in terms of security, a lot. PHP stopped supporting version 5.2 in January 2011 and stopped supporting version 5.3 in August 2014. It’s that simple, and without support, there are no longer security updates for these versions.

Branch Initial release Active support until Security support up to
5.6 August 28, 2014 January 19, 2017 December 31, 2018
7.0 December 3, 2015 December 3, 2017 December 3, 2018
7.1 December 1, 2016 December 1, 2018 December 1, 2019
5.3 – 5.4 – 5.5
Active support Current supported version. Reported bugs and security issues are fixed and timely releases are made.
Security fixes only A version that is only maintained to correct critical security problems.
End of life A version that is no longer supported. Users of this version should be updated as soon as possible as they may be exposed to unpatched security vulnerabilities.

That they are not stable versions and are not officially supported does not mean that you cannot use them, but at least you will know that your CMS may need to be updated to work with a stable PHP version.

Different versions of PHP coexisting in your Hosting

When speaking of PHP, it is understood that there is a globally enabled one for your entire Hosting account, which is established in the file php.ini hosted on the server, and possibly outside your user account (not accessible to you) and another version that you can set individually for a certain website, if you manage several in your Hosting.

For example, your server can have PHP 5.6 enabled globally and you, in your Hosting account, forced through a directive Addhandler or of mod_lsapiYou can have a lower or higher version of PHP than the one established, by CMS own requirements or PHP script that you execute.

Another possibility is that you have for example in the main folder of the Hosting a website created with a CMS whose version is old and does not support versions higher than PHP 5.3 and in another folder that could be / public_html / store you have installed the latest version of PrestaShop 1.7 .x that requires PHP 7.0 or 7.1 to work.

Finding out the PHP version

There are different ways at your disposal to find out which PHP version is running on your Hosting account. I show you in detail what they are.

Check the PHP version with php.info – a classic!

If you are familiar with some programming language or code, you can try to find out your active PHP version using the function phpinfo () which will give you important information about PHP settings, of course, including the PHP version.

In order to use this function you have to create a text file and call it phpinfo.php. Then you add the following code in this file:


Once you have saved it, from your browser (another tab or window) you call your domain and then the file name:

 http://tu-dominio.com/phpinfo.php

If your Hosting does not “layer” this functionality (in the hands of malicious people it can serve to provide Hosting information that could be used to attack it if vulnerable versions are detected), you can see the result that phpinfo () throws on screen:

Information obtained with phpinfo

PHP version from cPanel

In cPanel you can find out which version of PHP you have installed in various ways:

In the main cPanel panel, right widget (versions of cPanel with skin paper_lantern) General Information.

General Information

At the end of this widget you find a linkable text: Server InformationPHP version.

PHP version

You can also use the File Manager of your cPanel.

CPanel File Manager

Use the File Manager to navigate to the user folder / home / where you will find the “hidden” .htaccess file

Hidden .htaccess file

If you edit the cited file using the Code Editor (upper option of that screen) you will see the first line that should refer to the PHP version enabled globally for the entire Hosting account.

Globally enabled PHP version

PHP version from your CMS

In WordPress:

By default, the WordPress dashboard does not show the version nor are there native functionalities that allow you to see this information and others on the server in some of the CMS sections.

A simple alternative that hardly takes up space in your installation is the use of the plugin Display PHP Version that you install and activate it in a plis plas and it will show you the PHP version.

Display PHP Version

Click on the image to go to the plugin link

There are many other plugins that show this and other information But they also add more unnecessary options!

In PrestaShop:

This CMS does allow you to see in the backoffice the information related to the PHP version that is being detected, although this version can be the global version (the entire Hosting account) and not necessarily the one enabled for a PrestaShop installation that is in certain folder other than / public_html.

Access the backoffice, go to Advanced Parameters and click on the submenu information. In the block Server Information You will see this information.

Server Information

In Joomla:

From the Joomla backend (stable version 3.7.x) it is possible to see the PHP version in use in the current installation, even if it is in a different folder from / public_html

Access the backend, go to System and click on the submenu System information. In the first tab you will see PHP version You will see this information.

PHP version

In Moodle:

If you have a Moodle installation you can also check the version, among other data, by accessing the administration of your eLearning CMS, left menu Site administration, displaying the section Server and within this the option Environment.

Environment

Is it safe to show PHP version

There are other ways to get the PHP version, either by looking at the HTTP headers of a website or by using external tools online or installed on an operating system.

If you go into depth about what it may mean to reveal the PHP version that a certain website runs, especially if it is an obsolete or vulnerable version, it is possible to silence this information by adding the following lines in the .htaccess file:

ServerTokens Prod ServerSignature Off RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC] RewriteRule .* - [F]

Naturally, this code will not prevent the HTTP headers of your website from showing the version, but it will make it a little more difficult for other tools that search this data in an automated way to obtain vulnerable sites.

The Websites Are Us servers have the directive expose_php = Off that is to say disabled, so it will not be visible in the HTTP headers. You can sleep a little more peacefully!

What is the best version for my CMS?

This question is sure that you have asked yourself lately without really knowing which is the most convenient version for your web installation.

I am going to try to describe in a simple list which version of PHP is appropriate for your CMS and its version, so that you do not accidentally activate another version that leaves your website inoperative, with execution errors, or with a 500 error.

CMS PHP version
WordPress 4.7.0 and higher versions PHP 7.0 / 7.1 or higher
WordPress 4.6.5 and earlier versions PHP 5.6.x or lower versions
Other versions of WordPress are neither stable nor recommended for use.
PrestaShop 1.7.x and higher versions PHP 7.0 / 7.1 or higher
PrestaShop 1.6.1.x and earlier versions PHP 5.5 / 5.6
PrestaShop 1.5 and earlier PHP 5.4 (will depend on the version).
Other versions of PrestaShop are neither stable nor recommended for use.
Joomla 3.7.1 and higher versions PHP 7.0 / 7.1 or higher
Joomla 3.6.5 and earlier versions PHP 5.6 (will depend on the version).
Other versions of Joomla are neither stable nor recommended for use.

For other CMS it is better to check the CMS requirements page on the official project website.

Knowing now where to locate the active PHP version in your Hosting and which version is recommended for your CMS, let’s see how you can activate a global version, for all Hosting or for a certain website, if you have several installed.

Activate global PHP version

When you activate a PHP version for the entire Hosting, any script or content manager that you install, WordPress, PrestaShop, etc., will detect that version and will work under it, unless the CMS or script are incompatible under this version and errors are shown in your website or directly an error 500 (blank screen).

PHP 7.0 activation process for all Hosting:

  1. Access your cPanel Hosting Panel with skin “paper_lantern”.
  2. Find the section software
  3. Click on the option Configure PHP
  4. In section Set a default PHP version
  5. Click on the version selector. Select 7.0.x
  6. Click on the blue button Change

If the process was successful you will see the warning in green:

The PHP version has been changed. Changes take effect immediately.

At the end of that same screen locate the section List of configured sites and click on Refresh the page to see the updated information.

It will show you the different versions of PHP activated in Hosting, be it a global version (for all Hosting) or PHP versions applicable only to certain folders for specific websites.

PHP versions activated in Hosting

PHP 7.0 activation process for a specific web hosting:

  1. Access your cPanel Hosting Panel with skin “paper_lantern”.
  2. Find the section software
  3. Click on the option Configure PHP
  4. In section Change the PHP version for a website
  5. Click on the selector Domain. Select the affected domain.

By |2020-05-12T01:09:48+00:00May 12th, 2020|Administración del Hosting|