How to Install and Setup PHP5 FPM and Mariadb for Hiawatha Webserver on Centos
Edit Article

  • 1 Editor

PHP is a SSCL (Server Side Scripting Language) that is designed for web development. PHP is also used as a general purpose programming language. PHP originally stood for Personal Home Page but now it stands for recursive acronym PHP. The PHP code has an option to be embedded into the HTML code. It can also be used with a variety of Web template systems and web frameworks. Zend engine powers the standard PHP interpreter and is free software. PHP is widely used all over the world and it can be deployed on almost all the web servers. It supports almost all operating systems and platforms. PHP is free of charge.

Hiawatha, maybe you might not have heard of this name. This will not be a problem; Hiawatha is a new and advanced alternative to the Apache web browser. The curiosity level in me just went through the roof. This thing just demands to be loved. This webserver is not as popular as Apache but that did not stop it from gathering an increasing number of fans over the past couple of days. Hiawatha originated as a small webserver. This was suitable for old hardware. The main focus of designing this webserver was improved security. This webserver is a very light webserver that excels at giving the clients or users access to more efficient processing of their web pages. Multiple features exist in Hiawatha that makes it extraordinary among which is its lightweight design and the built in security features along with simplicity. You can find many features to stop using Apache and ditch it but I assure you that you will need to reason the start using Hiawatha instead. If you are still not satisfied then you maybe= go ahead and read about it. You will only find awesome reviews with additional great reasons of why it is time you start using Hiawatha.

The post here is written and assembled for the Hiawatha tutorial series. I will go ahead and stop. This much “bla bla” is more than enough. Let us start with the steps directly.


The first we need to is to install Hiawatha. Like Nginx, Hiawatha works quite nicely with PHP-fpm.


Login to your VPS as root, If not as a root then as a user who has sudo privileges:



Now you need to install PHP5 with fpm. You can install all those necessary PHP modules that you love along as well. To do so, use the below given command:

yum install php php-fpm php-common php-cli php-devel php-gd php-imap php-intl php-mysql php-process php-xml php-xmlrpc php-zts –y

Once you enter this command, you will see a screen somewhat like this:



You will have to make a few adjustments to the configuration. The reason for making and adjusting these configurations is that fact that we’ll be using PHP-fpm module. Let us first go ahead and edit the php.ini file in a text editor like Nano:

nano /etc/php.ini

Once this command is given, we will find and edit;' cgi.fix_pathinfo' and we will then change it to look like this: cgi.fix_pathinfo=0

It looked like this before:


And afterwards it looks something like this:


Once you have done so, save the file and exit the editor.


We will now need to set FastCgi to work and run. TO do so, we need to edit the PHP-fpm configuration file:

nano /etc/php-fpm.d/www.conf

We need to look for the line given below:

Listen =

Once found, we will edit this line and replace it with:

[[]]Listen = /var/lib/Hiawatha/ php-fcgi.sock



You need to scroll down the page. Once you’ve scrolled down a bit, you will find pm = dynamic. You will change that to pm = static.



Along with the first change you will also need to change pm.max_children value to whatever lesser value you want to give it.



You need to chnge chdir value to / .


Once you are done doing that, save the changes and exit the editor.



You will now edit the Hiawatha.conf file:

nano /etc/hiawatha/hiawatha.conf

Find this line: #CGIhandler = /usr/bin/php-cgi:php'. Once found, remove the '#' part from it.


Step-9: You will also replace these lines in the file: #FastCGIserver {' # FastCGIid = PHP5 # ConnectTo = # Extension = php #}


FastCGIserver { FastCGIid = PHP5 ConnectTo = /var/lib/hiawatha/php-fcgi.sock Extension = php }



Before exiting you need to edit the Virtual host settings that are also inside the same file. Look for the file and then remove the # symbol from the UseFastCGI = PHP5 line. It will look like this:


You will now save the changes that you made and then exit.


After you have saved all the changes, restart Hiawatha and php-fpm by entering the following command:

service hiawatha stop;service hiawatha start;service php5-fpm restart



You need to issue the following command:

yum install mariadb-server mariadb –y



You will now start MariaDB service by using the systemctl command:

systemctl start mariadb.service

To make sure that MariaDB runs every time fter you rsevrer reboots, issue the following command:

systemctl enable mariadb.service



The MariaDB service is now running but you should configure a few things on the very beginning. So you should do this immediately and configure your MariaDB setup, setup your mysql root password. Issue the following command:


You will now see a series of questions. Just answer these questions accordingly . The important part of this step is setting up the root password. The rest is up to you. You can set everything else the way you want to and just press “ENTER” key. You should keep hitting the key through every prompt to accept all the default values.


Now you will test the newly installed MariaDB by logging into it as root:

mysql -u root –p


I honestly won’t suggest you to follow this tutorial on the production server.

Article Tools

Did this article help you?


an Author!

Write an Article