Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/feed-rss2.php on line 8
Use PHP5-FPM with Apache 2 on Ubuntu 14.04 – AKLWEB HOST LLC Support Center https://support.aklwebhost.com Sat, 14 Dec 2019 19:20:22 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.4 Use PHP5-FPM with Apache 2 on Ubuntu 14.04 https://support.aklwebhost.com/knowledgebase/use-php5-fpm-with-apache-2-on-ubuntu-14-04/ https://support.aklwebhost.com/knowledgebase/use-php5-fpm-with-apache-2-on-ubuntu-14-04/#respond Sat, 14 Dec 2019 19:20:22 +0000 https://support.aklwebhost.com/?post_type=manual_kb&p=2765 Introduction

Apache is popular web server software that is used by most web hosting providers. PHP5-FPM is a FastCGI implementation for PHP. It is useful for processing PHP scripts on busy websites.

Rationale

Normally, Apache uses mod_php to process PHP pages on your VPS. Mod_php consumes more resources than PHP5-FPM. Since Apache is also compatible with PHP5-FPM, we can use that option to reduce the resource usage and improve performance.

Installation

Step 1

Install and activate apache2-mpm-event by running the following commands:

sudo apt-get update
sudo apt-get install apache2-mpm-event

You can test Apache’s server status with this command:

sudo service apache2 status

If the service is running, “apache2 is running” will be printed to your terminal. Otherwise, you can start the service with this command:

sudo service apache2 start

Step 2

To use PHP5-FPM with Apache, we need to install libapache2-mod-fastcgi module. The libapache2-mod-fastcgi module is not available in the Ubuntu package. Therefore, we need to update the apt sources. Follow these steps.

  1. Run the following command to edit the source list:
    sudo nano /etc/apt/sources.list
    
  2. Add the following lines at the end of the file:
    deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
    deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
    deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
    deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
    
  3. Press CTRL + X, then Y to save the file.
  4. Install libapache2-mod-fastcgi:
    sudo apt-get update
    sudo apt-get install libapache2-mod-fastcgi
    

Step 3

Install PHP5-FPM with the following command:

sudo apt-get install php5-fpm

Step 4

Create the PHP5-FPM configuration file for Apache:

sudo nano /etc/apache2/conf-available/php5-fpm.conf

… then add the following lines:

<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization

<Directory /usr/lib/cgi-bin>
    Require all granted
</Directory>

</IfModule>

Press CTRL + X, then Y to save the file.

Enable the new modules and configuration for Apache:

sudo a2enmod actions fastcgi alias
sudo a2enconf php5-fpm

Finally, restart Apache:

sudo service apache2 restart

Step 5

Test your installation by creating a test PHP file:

sudo nano /var/www/html/info.php

Add the following content to the file:

<?php phpinfo(); ?>

Press CTRL + X, then Y to save the file.

Now open the http://[SERVER_IP_ADDRESS]/info.php in browser. Upon success, you will see information about PHP and your server. Your setup is now complete.

]]>
https://support.aklwebhost.com/knowledgebase/use-php5-fpm-with-apache-2-on-ubuntu-14-04/feed/ 0