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.

INSTALLING PHP5:

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


Step-1:


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

1

Step-2:


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:

2

SETTING UP PHP5-FPM: Step-3:


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:

3

And afterwards it looks something like this:

4

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


Step-4:


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 = 127.0.0.1:9000


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


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

5

Step-5:


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.

6

Step-6:


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

7

Step-7:


You need to chnge chdir value to / .

8

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

SETTING THE SERVER PHP CONFIGURATION:

Step-8:


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.

9

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


With




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

10


Step-10:


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:

11

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


Step-11:


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

12

INSTALLING MARIADB: Step-1:


You need to issue the following command:


yum install mariadb-server mariadb –y

13

Step-2:




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

13

Step-3:


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:




mysql_secure_installation


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.

15



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


mysql -u root –p

16



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

Article Tools

Did this article help you?

YesNo

Become
an Author!

Write an Article