Category Archives: Tutorials

Error Upgrading PHP 5.3 to 5.4

CentOS 6.5 ships with the default PHP 5.3.3 (although support for PHP 5.3 officially ended on 14th August 2014). Naturally, the CentOS team has backported all the security issues discovered in PHP5.3, and it is a stable and matured version. However, the PHP team at recommends upgrading to PHP 5.4 to fully benefit from all the recent enhancements, bug-fixes and security patches in PHP.

This tutorial will guide you through the steps needed to upgrade PHP 5.3 to the latest PHP 5.4 without breaking any of existing websites in Virtualmin.


The first step is to install the “REMI” software repository (this software repo is maintained by French guy, Remi Collet) and it (usually) has the latest stable version of the software used by RedHat/CentOS and the EPEL repo. In fact, it requires the EPEL repo to be installed on your server before you can install the REMI repo.

Note the latest version of these software, visit:

EPEL Repo:

REMI Repo:

For the purpose of this tutorial, we’ll be using the repositories for CentOS 6.5.

Step 1: Download EPEL and REMI and install the repository

rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

Step 2: Update EPEL repository

yum update -y

Step 3: Enable the REMI repo and Upgrade software

yum –enablerepo=remi upgrade mysql

The command above may seemed a bit odd, why “upgrade mysql” when we want to actually upgrade PHP 5.3 to PHP 5.4? The reason is that the yum software utility will install/upgrade all dependencies to ensure that all the software pieces work together.

The default Virtualmin installation has setup “php-mysql” – and when we issue the command ‘upgrade mysql’ – the yum utility will also upgrade all the related PHP packages (e.g. php-gd, php-devel, php-mbstring, php-cli, etc) from version 5.3 to 5.4

Once the installation/upgrade process has completed, you need to run the ‘mysql_upgrade’ command to update some of the essential tables in MySQL 5.5.

mysql_upgrade -uroot

Enter the mysql root password when prompted. Once done, you can verify you have the latest version of PHP 5.4 and also MySQL 5.5


Step 4: Edit /etc/httpd/conf.d/php.conf

This is the final step before you restart Apache.  In the /etc/httpd/conf.d/ directory, you will find the following *.conf files – e.g.

  • fcgid.conf
  • php.conf
  • awstats.conf
  • webalizer.conf
  • mailman.conf
  • etc.

These are the additional directives that Apache will run each time it starts (or restarts). When we upgrade PHP 5.3 to PHP 5.4, the configuration file “php.conf” was updated to include the following lines of code:

<FilesMatch \.php$>
SetHandler application/x-httpd-php

You need to either delete  those 3 lines or comment them out. And in their place, insert:

AddHandler php5-script .php

This will prevent your PHP powered websites from breaking when you restart Apache.

Now, go ahead and issue the command to restart Apache and enjoy the latest version of PHP 5.4.34 (as of Oct 2014) on your Virtualmin server.


How to install the latest Nginx in Virtualmin

This short tutorial is based on this original article at Virtualmin wiki with a few tweaks to enable us to run the latest stable version of Nginx software in Virtualmin.

Over the short few years since Nginx was first introduced, it has grown by leaps and bounds in popularity and it is currently being used by 40% of the world’s busiest websites. It is fast, stable and uses less resources compared to the Apache webserver. But we will not go into the Apache vs Nginx here …

But before you install Nginx, please be aware of the following:

  • If you currently have a Virtual Server running on Apache, you can’t install Nginx because Virtualmin will only allow you to run either Apache or Nginx. You can’t run both on port 80.
  • Once you’ve installed Nginx, you will need to disable Apache from the Virtualmin’s Plugin & Features page.
  • Virtualmin (at this point in time) does not support Nginx as Reverse-Proxy. If you are interested in this topic (running Nginx as reverse proxy to Apache), let me know and I’ll put up a tutorial on it later.

You can install Nginx from Virtualmin’s software repository which provides an older version of the Nginx software (version 1.0.9 as of this writing – 23 Oct 2014). Most software repositories such as the CentOS repo, EPEL, Ubuntu, etc do not carry the latest version. But if you want to install the latest stable version, you need to go to the source directly and install the Nginx repository.

Goto: and download the version for your Operating System.

In our case, we will base this tutorial on CentOS 6.5.

Step 1: Download the Nginx repo and install it. Then run the ‘yum’ command to install Nginx


rpm -ivh nginx-release-rhel6*

yum install nginx -y

Step 2: Shutdown the Apache webserver & start the Nginx webserver

/sbin/service httpd stop && chkconfig httpd off

/sbin/service nginx start

Step 3: Install the Virtualmin’s Nginx plugin

yum install wbm-virtualmin-nginx wbm-virtualmin-nginx-ssl

Step 4: Login to Virtualmin and go to “System Setings” –> “Plugin & Features”

Disable the following:

  • Apache Webserver
  • SSL Website
  • DAV login
  • Webalizer Reporting
  • AWstats Reporting
  • Mailman
  • Protected Directories
  • Subversion repositories

Enable the following:

  • Nginx Website
  • Nginx SSL website

See the screenshot of the Virtualmin’s “Plugin and Features” page:


Once you’ve done this, Nginx support has been enabled in Virtualmin and you should be able to create Virtual Servers as normal.

However, do take note that when using Nginx instead of the Apache webserver, there are some limitations to consider:

  • Nginx does not support CGI, so any applications or Virtualmin scripts that use CGI will not work.
  • PHP can only be executed via FastCGI, and all PHP scripts run with domain owner permissions.  Virtualmin will setup a PHP FastCGI server process that communicates with Nginx for each virtual server. mod_php is not supported.
  • Only one PHP version (usually the highest) will be used by Nginx.
  • You can only install one SSL certificate per IP address on your virtual server – even if you have a wildcard or UCC certificate. To install additional certificates, you would need to have additional IP addresses.