PHP is one of the most popular scripting languages used on many websites.
Webmin server support multiple PHP versions. Thus, users get more flexibility while designing websites. At times, these PHP versions can create conflict and may not work properly.
At Bobcares, we often get requests from our customers to resolve the problems with “Webmin multiple PHP versions” as part of our Server Management Services.
Today, we’ll see how our Support Engineers solved the errors related to “Webmin multiple PHP versions”.
How we configure multiple PHP versions in Webmin
In Webmin, multiple PHP versions can be used in the same server. Also, it allows selecting different PHP for versions per domain and per directory. That means, a user can build his website on PHP5.x or PHP7.x.
To set up multiple PHP versions in Webmin, our Support Engineers took the following steps.
For example in CentOS 6,
1. Firstly, we login into the server as a root user.
2. To Install PHP 5.6 and PHP 7 on CentOS 6, we run the below commands.
yum install centos-release-scl
Install the PHP packages:
yum install rh-php56 rh-php56-php-mysqlnd yum install rh-php70 rh-php70-php-mysqlnd
3. Next, we enable “suexec_module” on the server, it helps to recognize different PHP versions.
4. For that open httpd.conf, Then find and uncomment the line “#LoadModule suexec_module modules/mod_suexec.so.
5. Also, we save and close the file. Then restart Apache
service httpd restart
6. Again, we log into your Webmin control panel
7. Then, we go to “Server Configuration > PHP version” and select the appropriate PHP version.
8. Finally, we click the Save button.
On successful installation, both PHP versions shows up on the Webmin interface. A sample software versions list on a CentOS7 server looks as below.
How we fixed errors related to multiple PHP versions configuration
Now, let’s see how our Support Engineers solved the related errors with multiple PHP versions.
1. Incorrect Default PHP version on the server
Recently, one of our customers had an issue with his PHP versions. After he changed the PHP version 5.6 to 7, through Webmin front-end, it didn’t reflect when he checked at the backend. This happened due to wrong PHP default version.
Then our Support Engineers took the following steps to solve the issue.
1. We logged into the server and run the following command.
Then PHP version showed as PHP 5.6.
2. So we enabled PHP 7 as the default version on the server by linking the correct PHP binary.
That’s it. Now, the PHP version changed from 5.6 to 7
2. Missing PHP extensions
Sometimes, enabling PHP version doesn’t solve the problem. It may require updated PHP extension too.
So, our Support Engineers installed/updated them via software packages.
1. We logged into Webmin > System Software Packages > Chose Package from YUM > Click Browse YUM, typed the PHP extension name in the search box and clicked find packing matching button. Then, we clicked the Package name and install.
[ Having trouble while configuring Webmin multiple PHP versions? We’ll fix it for you.]
In short, it is possible to use “Webmin multiple PHP versions” on the same server. Also, Webmin allows different PHP versions to be selected for each domain and directory. Today, we saw how our Support Engineers configured multiple PHP version and solved related errors with it.