• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved How to install CentOS 8 Plesk 5 php version ?

Micro$oft

New Pleskian
Hi,
I installed Plesk panel on Centos 8, but php 5x versions have been removed. How do I install it ?
 
Hi,

I have manged to install php 5.6 in centos 8 using remi repo. Below are the steps which I have followed.

1. Install remi repo in centos 8


2. Install php 5.6 and its required modules

yum install php56.x86_64

3. Register the php.56 fcgi module with php, If all good you will get handler id and successfully registered message.

[root@~]# /usr/local/psa/bin/php_handler --add -displayname php-56 -path /usr/bin/php56-cgi -phpini /etc/opt/remi/php56/php.ini -clipath /usr/bin/php56 -type fastcgi
The new PHP handler with the id "150e2a3d0f6ca2bb60a26372169d231c3c758e6d" was successfully registered.
Screenshot from 2022-04-25 07-19-08.png

5. You can verify it using the below command

plesk bin php_handler --list |grep 5.6

Screenshot from 2022-04-25 07-19-31.png


6. Now the php version will be listed in front end of plesk in php version drop down

Screenshot from 2022-04-25 07-21-43.png
 
Please be careful when you install anything from a non-default OS repo, it can lead to problems when you update your server when a new Plesk version is available.
After you've installed PHP 5 from this Remi repo, you should disable the repo for the very same reason.
 
Last edited:
Hi guys,

Why, despite various security and supportability risks, do you want to install and use PHP5? Currently, PHP: Supported Versions does not show PHP5 at all (even as EOLed version).
IMHO, instead of researching how to install php5, I would suggest to invest time to research how to migrate to php8 :)
 
Hi guys,

Why, despite various security and supportability risks, do you want to install and use PHP5? Currently, PHP: Supported Versions does not show PHP5 at all (even as EOLed version).
IMHO, instead of researching how to install php5, I would suggest to invest time to research how to migrate to php8 :)

There are still web apps written for PHP5 that cannot be easily migrated to PHP 7/8. You can't force customers to upgrade their web apps if they don't know how to do it.
 
It is not a forcing, just a notice for everyone that installing php5 right now not solve the issue globally, it is potentially could bring more issues in the future. It is a quick workaround which becomes a technical debt at the same time.

Could you please provide examples of web apps which actual and do not provide versions for PHP7/8? Is there a reason why they continue using on PHP5?
 
Well, unfortunately not all customers are using modern CMS such as Wordpress. We too have customers that rely on old versions of PHP.

A classic situation is as follows: A small PME or non-profit foundation hired a web developer 10-15 years ago to create their website in a "shoot and forget" style: Create it, hand it over, sign it off and get paid for it.

Now, 10 years later, the website is outdated and PHP 5 has become obsolete. We inform that customer and ask them to update to PHP 7 or 8 but their old scripts won't work with those PHP versions. Customer has no IT that would take care of updating their website and they would need to hire somebody to rebuild their website for >1k EUR but they don't have the budget for it. Thus, they're begging us to keep PHP 5 "for the time being" until they have the budget for a new website (where "for the time being" could mean anything from 3 months to 5 years).

So we as their provider have the following options: Keep PHP 5 running to make the customers with old PHP scripts happy or turn off PHP 5 support which would result in customers leaving and thus lost revenues for us. It's a balancing act between security and revenue for us.
 
Like Monty has explained, In my case as well there is few customer websites that are done in very old versions of codeigniter, opencart and laravel which needs php 5.6 and clients are not having enough budget to invest on upgrades. So for the website to work atleat we have to enable php 5.6 in the server.
 
Hi,

I have manged to install php 5.6 in centos 8 using remi repo. Below are the steps which I have followed.

1. Install remi repo in centos 8



2. Install php 5.6 and its required modules



3. Register the php.56 fcgi module with php, If all good you will get handler id and successfully registered message.


View attachment 20685

5. You can verify it using the below command



View attachment 20686


6. Now the php version will be listed in front end of plesk in php version drop down

View attachment 20687
Hi! thanks, i've managed to get the FastCGI installation done. But i alsno need the FPM, i cannot get it registred in plesk. Is there anyone how can help me with the FPM registration in Plesk?
 
I've found a different solution for web apps that are written for PHP 5.6 and cannot be upgraded to PHP 7.* without lots of code refactoring.
If the issue is solely the absence of the mysqli_* function calls in the original code, this library works like a charm:


It replaces all mysql function calls with the corresponding function call in mysqli.

All you have to do is:
- upload the mysql.php file to the web app
- find the PHP file that's called most from other PHP files and add a require_once. In the old-style web apps, that's usually the PHP file that opens and connects the database.

i.e.:
Let's say the file dbconnect.php opens and connects the database. This is what you can do:

PHP:
<?php 

// Add this line of code:
require_once  __DIR__ . '/lib/mysql.php';

// This is the original code:
$host = "localhost";
$user = "dbuser";
$pass = "dbpasswd";
$db = "database";

$mysql = mysql_connect($host,$user,$pass) 
or die('Not connected : ' . mysql_error());

mysql_select_db($db, $mysql);

Next, switch to PHP 7.1; it should work without problems.
 
Back
Top