Install PHP 7.1 php-fpm from source

Lets install the requirements.

On CentOS, run

Before you can install, you need to check MySQL socket location. To do this, run following command in MySQL command prompt.

Find MySQL socket

Download and install PHP 7.1 from source

Copy the configuration files

Now you will be able to start php-fpm by running

By default php-fpm will run using tcp port 9000, it is better to change it to use unix socket, for this

Find

Replace with

php-fpm user

You need to configure the user account used to run php-fpm, if you don’t use proper account, you may get permission errors.

The account you use vary depending on OS, Web server. For example, nginx use account nginx. Apache on Ubuntu/Debian use www-data. Apache on CentOS use nobody.

Here is what i have on a server running Nginx web server

Systemd Service

To easily manage php-fpm, lets create a php-fpm.service file.

Before we do this, edit

Find

Add below

Find

Add below

Save and exit.

Now lets create file /usr/lib/systemd/system/php-fpm.service

Add following content

Enable php-fpm with

Now you will be able to use systemctl to start/stop/restart php-fpm

systemctl status php-fpm

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *