{"id":1685,"date":"2018-10-26T02:02:58","date_gmt":"2018-10-26T02:02:58","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=1685"},"modified":"2018-10-26T08:19:51","modified_gmt":"2018-10-26T08:19:51","slug":"mod_fastcgi-installation-on-apache-2-2","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/26\/mod_fastcgi-installation-on-apache-2-2\/","title":{"rendered":"mod_fastcgi Installation on Apache 2.2"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/linuxadmin.io\/wp-content\/uploads\/2017\/05\/mod_fastcgi.png\" alt=\"How to install mod_fastcgi\" width=\"644\" height=\"191\" \/><\/p>\n<h3>What is mod_fastcgi?<\/h3>\n<p>mod_fastcgi is an Apache module for interfacing with CGI programs allowing a server to handle more requests at one time. It does this by keeping an instance of php running in the background. When apache receives the request it forwards it to FasctCGI. It can increase performance and reduce memory useage over mod_php. If you have not already done so, you will need to setup php-fpm for this to work. Please the following guide on how to do so <a href=\"https:\/\/linuxadmin.io\/php-fpm-php7-source\/\">Install PHP-FPM<\/a><\/p>\n<h3>Install mod_fastcgi<\/h3>\n<p>First get the required the required packages<\/p>\n<p>wget -O \/usr\/src\/mod_fastcgi-2.4.6.tar.gz https:\/\/github.com\/txduncan\/mod_fastcgi\/blob\/master\/mod_fastcgi-2.4.6.tar.gz<\/p>\n<p>Change to the download directory:<\/p>\n<p>cd \/usr\/src<\/p>\n<p>Uncompress the package:<\/p>\n<p>tar xfvz mod_fastcgi-2.4.6.tar.gz<\/p>\n<p>Copy the make file:<\/p>\n<p>cp \/usr\/src\/mod_fastcgi-2.4.6\/Makefile.AP2 \/usr\/src\/mod_fastcgi-2.4.6\/Makefile<\/p>\n<p>Make and install the package<\/p>\n<p>make top_dir=\/usr\/lib64\/httpd make top_dir=\/usr\/lib64\/httpd install<\/p>\n<p>If the build directory differs from the standard apache build you will need to update top_dir to the parent directory of the build directory<\/p>\n<h3>Configure Apache to use mod_fastcgi<\/h3>\n<p>Edit \/etc\/httpd\/conf\/httpd.conf and add<\/p>\n<p>LoadModule fastcgi_module lib\/apache\/mod_fastcgi.so<\/p>\n<h4>To make the entire Apache server to use php-fpm with mod_fastcgi:<\/h4>\n<p>Comment out any additional references to php in httpd.conf<\/p>\n<p># LoadModule php5_module modules\/libphp5.so<br \/>\n# AddType application\/x-httpd-php .php<\/p>\n<p>Edit \/etc\/httpd\/conf\/httpd.conf and add the following<\/p>\n<p>LoadModule fastcgi_module modules\/mod_fastcgi.so<\/p>\n<p>Edit \/etc\/httpd\/conf.d\/fastcgi.conf and add the following<\/p>\n<p>&lt;IfModule mod_fastcgi.c&gt;<br \/>\nFastCGIExternalServer \/usr\/sbin\/php-fpm -host 127.0.0.1:9000<br \/>\nAddHandler php-fastcgi .php<br \/>\nAction php-fastcgi \/usr\/sbin\/php-fpm.fcgi<br \/>\nScriptAlias \/usr\/sbin\/php-fpm.fcgi \/usr\/sbin\/php-fpm<br \/>\n&lt;Directory \/usr\/sbin&gt;<br \/>\nOptions ExecCGI FollowSymLinks<br \/>\nSetHandler fastcgi-script<br \/>\nOrder allow,deny<br \/>\nAllow from all<br \/>\n&lt;\/Directory&gt;<br \/>\n&lt;\/IfModule&gt;<\/p>\n<p>Be sure to update the path to the php-fpm binary in the above configuration, to find it do:<\/p>\n<p>which php-fpm<\/p>\n<p>Add a include in \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>Include \/etc\/httpd\/conf.d\/fastcgi.conf<\/p>\n<p>Restart Apache to load the new configuration:<\/p>\n<p>service httpd restart<\/p>\n<p>Once you have done that go ahead and create a test file in a Apache document root:<\/p>\n<p>&lt;?php<br \/>\nphpinfo();<br \/>\n?&gt;<\/p>\n<p>Visiting that page should show the PHP variables from the newly configured mod_fastcgi.<\/p>\n<p>May 21, 2017LinuxAdmin.io<\/p>\n<p><a href=\"https:\/\/linuxadmin.io\/mod_fastcgi-installation-apache\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is mod_fastcgi? mod_fastcgi is an Apache module for interfacing with CGI programs allowing a server to handle more requests at one time. It does this by keeping an instance of php running in the background. When apache receives the request it forwards it to FasctCGI. It can increase performance and reduce memory useage over &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/26\/mod_fastcgi-installation-on-apache-2-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;mod_fastcgi Installation on Apache 2.2&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1685","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=1685"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1685\/revisions"}],"predecessor-version":[{"id":1731,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/1685\/revisions\/1731"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=1685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=1685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=1685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}