{"id":939,"date":"2017-01-17T12:18:10","date_gmt":"2017-01-17T12:18:10","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=939"},"modified":"2017-01-18T14:27:06","modified_gmt":"2017-01-18T14:27:06","slug":"converting-website-mod_php-5-6-29-php56u-fpm-httpd","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2017\/01\/17\/converting-website-mod_php-5-6-29-php56u-fpm-httpd\/","title":{"rendered":"Converting a Website from mod_php 5.6.29 to php56u-fpm-httpd"},"content":{"rendered":"<p>So a customer wanted us to convert their PHP site to use the php-fpm. The reason was, that php-fpm can run as it&#8217;s own user and group, and isn&#8217;t limited in it&#8217;s execution in the same way that apache is on the filesystem with the regular version of php. <\/p>\n<p>This is how I achieved it.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nyum install php-fpm.x86_64 php56u-fpm-httpd.noarch\r\n\r\n# for some reason if you get a weird error install them seperately\r\nyum install php-fpm.x86_64 \r\nyum install php56u-fpm-httpd.noarch\r\n<\/pre>\n<p>Then you will need to run the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl enable php-fpm\r\nsystemctl enable httpd\r\n\r\nsystemctl start php-fpm\r\n# check the status\r\nsystemctl status php-fpm\r\n<\/pre>\n<p>If necessary like it was for me change \/etc\/php-fpm.d\/www.conf to reflect the following<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nlisten = \/var\/run\/php-fpm\/default.sock\r\n\tlisten.owner = apache\r\n\tlisten.group = apache\r\n\tlisten.mode = 0660\r\n\r\n# Also make sure you set the correct execution group, the listen socket perms are different\r\n# as I have found out from experience\r\n\r\n; Unix user\/group of processes\r\n; Note: The user is mandatory. If the group is not set, the default user's group\r\n;       will be used.\r\nuser = sftpusercangohere\r\ngroup = apache\r\n<\/pre>\n<p>If necessary, you will want to use a Custom user\/group for php-fpm. This is one of the advantages of using FPM.<\/p>\n<p>Also, you can use EVENT MPM instead of PREFORK MPM, it&#8217;s more efficient with fpm, and certainly worth considering. This step is optional, and not required for fpm to work<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# Comment out this line\r\n#LoadModule mpm_prefork_module modules\/mod_mpm_prefork.so\r\n\r\n#Uncomment the following\r\nLoadModule mpm_event_module modules\/mod_mpm_event.so\r\n<\/pre>\n<p>Edit your httpd.conf file in \/etc\/htpd\/conf.d\/* or \/etc\/httpd\/httpd.conf and ensure in side the Virtualhost directive you have the following set:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n ProxyPassMatch ^\/(.*\\.php)$ fcgi:\/\/127.0.0.1:9000\/var\/www\/vhosts\/yourwebsite.com\/html\/$1\r\n<\/pre>\n<p>Where html is the documentroot of the site.<\/p>\n<p>This article is kind of complete but still a bit drafty.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So a customer wanted us to convert their PHP site to use the php-fpm. The reason was, that php-fpm can run as it&#8217;s own user and group, and isn&#8217;t limited in it&#8217;s execution in the same way that apache is &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2017\/01\/17\/converting-website-mod_php-5-6-29-php56u-fpm-httpd\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/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":[18],"tags":[],"class_list":["post-939","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=939"}],"version-history":[{"count":3,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/939\/revisions"}],"predecessor-version":[{"id":942,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/939\/revisions\/942"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}