Building PHP with PHP-FPM for Nginx from Sources on Ubuntu

This documentation is going to tell you how to install and configure PHP with PHP-FPM for a Nginx server from sources on Ubuntu.

1. Install gcc and make tools.

2. Building Nginx from source on Ubuntu

3. Download and extract PHP source codes.
Download page:

4. Configure and make install PHP

type “./configure –help” to see all the supported parameters.

5. Fix errors occurs during installation

5.1 “configure: error: xml2-config not found. Please check your libxml2 installation.”

6. Configure Nginx
6.1 create directories config/sites-available config/sites-enabled
6.2 edit config file nginx.conf

6.3 edit config file fastcgi_params
add the following two lines into config file conf/fastcgi_params

6.3 add config file config/sites-available/ for site

6.4 Enable site

6.5 Reload Nginx
tips “./nginx -h”

The you can find out the commands for reload nginx

7. Restart PHP-FPM

Test by phpinfo()

The use a browser (ie sucks) to open the page “http://yousite/phpinfo.php”  to check the result.






Leave a Reply

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