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/rest-api/class-wp-rest-server.php on line 1794

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/rest-api/class-wp-rest-server.php on line 1794

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/rest-api/class-wp-rest-server.php on line 1794

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/rest-api/class-wp-rest-server.php on line 1794

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/rest-api/class-wp-rest-server.php on line 1794

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/rest-api/class-wp-rest-server.php on line 1794

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/rest-api/class-wp-rest-server.php on line 1794

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/rest-api/class-wp-rest-server.php on line 1794
{"id":2765,"date":"2019-12-14T19:20:22","date_gmt":"2019-12-14T19:20:22","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2765"},"modified":"2019-12-14T19:20:22","modified_gmt":"2019-12-14T19:20:22","slug":"use-php5-fpm-with-apache-2-on-ubuntu-14-04","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/use-php5-fpm-with-apache-2-on-ubuntu-14-04\/","title":{"rendered":"Use PHP5-FPM with Apache 2 on Ubuntu 14.04"},"content":{"rendered":"

Introduction<\/h2>\n

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.<\/p>\n

Rationale<\/h3>\n

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.<\/p>\n

Installation<\/h2>\n

Step 1<\/h3>\n

Install and activate\u00a0apache2-mpm-event<\/code>\u00a0by running the following commands:<\/p>\n

sudo apt-get update\r\nsudo apt-get install apache2-mpm-event\r\n<\/code><\/pre>\n

You can test Apache’s server status with this command:<\/p>\n

sudo service apache2 status\r\n<\/code><\/pre>\n

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

sudo service apache2 start\r\n<\/code><\/pre>\n

Step 2<\/h3>\n

To use PHP5-FPM with Apache, we need to install\u00a0libapache2-mod-fastcgi<\/code>\u00a0module. The\u00a0libapache2-mod-fastcgi<\/code>\u00a0module is not available in the Ubuntu package. Therefore, we need to update the\u00a0apt<\/code>\u00a0sources. Follow these steps.<\/p>\n

    \n
  1. Run the following command to edit the source list:\n
    sudo nano \/etc\/apt\/sources.list\r\n<\/code><\/pre>\n<\/li>\n
  2. Add the following lines at the end of the file:\n
    deb http:\/\/us.archive.ubuntu.com\/ubuntu\/ trusty multiverse\r\ndeb-src http:\/\/us.archive.ubuntu.com\/ubuntu\/ trusty multiverse\r\ndeb http:\/\/us.archive.ubuntu.com\/ubuntu\/ trusty-updates multiverse\r\ndeb-src http:\/\/us.archive.ubuntu.com\/ubuntu\/ trusty-updates multiverse\r\n<\/code><\/pre>\n<\/li>\n
  3. Press\u00a0CTRL<\/strong>\u00a0+\u00a0X<\/strong>, then\u00a0Y<\/strong>\u00a0to save the file.<\/li>\n
  4. Install\u00a0libapache2-mod-fastcgi<\/code>:\n
    sudo apt-get update\r\nsudo apt-get install libapache2-mod-fastcgi\r\n<\/code><\/pre>\n<\/li>\n<\/ol>\n

    Step 3<\/h3>\n

    Install PHP5-FPM with the following command:<\/p>\n

    sudo apt-get install php5-fpm\r\n<\/code><\/pre>\n

    Step 4<\/h3>\n

    Create the PHP5-FPM configuration file for Apache:<\/p>\n

    sudo nano \/etc\/apache2\/conf-available\/php5-fpm.conf\r\n<\/code><\/pre>\n

    … then add the following lines:<\/p>\n

    <IfModule mod_fastcgi.c>\r\nAddHandler php5-fcgi .php\r\nAction php5-fcgi \/php5-fcgi\r\nAlias \/php5-fcgi \/usr\/lib\/cgi-bin\/php5-fcgi\r\nFastCgiExternalServer \/usr\/lib\/cgi-bin\/php5-fcgi -socket \/var\/run\/php5-fpm.sock -pass-header Authorization\r\n\r\n<Directory \/usr\/lib\/cgi-bin>\r\n    Require all granted\r\n<\/Directory>\r\n\r\n<\/IfModule>\r\n<\/code><\/pre>\n

    Press\u00a0CTRL<\/strong>\u00a0+\u00a0X<\/strong>, then\u00a0Y<\/strong>\u00a0to save the file.<\/p>\n

    Enable the new modules and configuration for Apache:<\/p>\n

    sudo a2enmod actions fastcgi alias\r\nsudo a2enconf php5-fpm\r\n<\/code><\/pre>\n

    Finally, restart Apache:<\/p>\n

    sudo service apache2 restart\r\n<\/code><\/pre>\n

    Step 5<\/h3>\n

    Test your installation by creating a test PHP file:<\/p>\n

    sudo nano \/var\/www\/html\/info.php\r\n<\/code><\/pre>\n

    Add the following content to the file:<\/p>\n

    <?php phpinfo(); ?>\r\n<\/code><\/pre>\n

    Press\u00a0CTRL<\/strong>\u00a0+\u00a0X<\/strong>, then\u00a0Y<\/strong>\u00a0to save the file.<\/p>\n

    Now open the\u00a0http:\/\/[SERVER_IP_ADDRESS]\/info.php<\/code>\u00a0in browser. Upon success, you will see information about PHP and your server. Your setup is now complete.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[109,247],"manual_kb_tag":[423],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2765"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2765"}],"version-history":[{"count":1,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2765\/revisions"}],"predecessor-version":[{"id":2770,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2765\/revisions\/2770"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2765"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2765"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}