<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Install php-fpm centos7 Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/install-php-fpm-centos7/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Tue, 13 Nov 2018 21:40:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>Install Nginx with PHP 7.2.10 and PHP-FPM on Fedora 29  and RHEL/Centos 7.6</title>
		<link>https://www.osradar.com/install-nginx-with-php-7-2-10-and-php-fpm-on-fedora-29-and-rhel-centos-7-6/</link>
					<comments>https://www.osradar.com/install-nginx-with-php-7-2-10-and-php-fpm-on-fedora-29-and-rhel-centos-7-6/#respond</comments>
		
		<dc:creator><![CDATA[Mel]]></dc:creator>
		<pubDate>Tue, 13 Nov 2018 21:05:09 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Install php-fpm centos7]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=7085</guid>

					<description><![CDATA[<p>In this  tutorial we will show you how to install Nginx in Combination with last php stable version and included  PHP-FPM (FastCGI Process Manager) i will not explain about nginx, i assume that everyone knows that very perfect web server and even better than apache My Servers  is  Centos 7  with   IP : 192.168.2.98 Client [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-nginx-with-php-7-2-10-and-php-fpm-on-fedora-29-and-rhel-centos-7-6/">Install Nginx with PHP 7.2.10 and PHP-FPM on Fedora 29  and RHEL/Centos 7.6</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this  tutorial we will show you how to install Nginx in Combination with last php stable version and included  <strong><a title="PHP-FPM Home Page" href="http://php-fpm.org/" target="_blank" rel="noopener">PHP-FPM (FastCGI Process Manager)</a></strong></p>
<p>i will not explain about nginx, i assume that everyone knows that very perfect web server and even better than apache</p>
<p>My Servers  is  Centos 7  with   IP : 192.168.2.98</p>
<p>Client is  Debian 9    with IP  : 192.168.2.98</p>
<p>Lets  start :</p>
<p><strong>A.1 Change to root user.</strong></p>
<pre class="">su -</pre>
<p><strong>A.2 Install Needed repositories</strong></p>
<p>Fedora 28/29</p>
<pre class="">##Fedora 29 ##
rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-29.rpm

## Fedora 28 ##
rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-28.rpm</pre>
<p>CentOS 7.5/6.10 and Red Hat (RHEL) 7.5/6.10 Remi repository</p>
<pre class="">## Remi Dependency on CentOS 7 and Red Hat (RHEL) 7 ##
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

## CentOS 7 and Red Hat (RHEL) 7 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

## CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm</pre>
<p><strong>CentOS 7.6/6.10 and Red Hat (RHEL) 7.6/6.10  add Nginx repository</strong></p>
<p>Create repo  file /etc/yum.repos.d/nginx.repo :<br />
<strong>For CentOS</strong></p>
<pre class="">[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1</pre>
<p><strong>Red Hat (RHEL)</strong></p>
<pre class="">[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1</pre>
<p><strong>A.3 Install Nginx, PHP 7.2.11 and PHP-FPM</strong><br />
<strong>Fedora 28</strong></p>
<pre class="">dnf install nginx php-fpm php-common

===============================================================================
Package Arch Version Repository Size
===============================================================================
Installing:
php-fpm x86_64 7.2.11-1.fc29 updates 1.5 M
nginx x86_64 1:1.12.1-14.fc29 fedora 518 k
Installing dependencies:
httpd-filesystem noarch 2.4.37-2.fc29 updates 15 k
php-common x86_64 7.2.11-1.fc29 updates 1.0 M
gperftools-libs x86_64 2.7-3.fc29 fedora 304 k
libunwind x86_64 1.2.1-6.fc29 fedora 61 k
nginx-filesystem noarch 1:1.12.1-14.fc29 fedora 9.6 k
nginx-mimetypes noarch 2.1.48-4.fc29 fedora 20 k

Transaction Summary</pre>
<p><strong>Fedora 27/26</strong></p>
<pre class="">dnf --enablerepo=remi --enablerepo=remi-php72 install nginx php-fpm php-common</pre>
<p><strong>CentOS 7.6/6.10 and Red Hat (RHEL) 7.6/6.10</strong></p>
<pre class="">yum --enablerepo=remi,remi-php72 install nginx php-fpm php-common</pre>
<p><strong>1.4 Install PHP 7.2.11 modules</strong></p>
<p>OPcache (php-opcache) – The Zend OPcache provides faster PHP execution through opcode caching and optimization.<br />
APCu (php-pecl-apcu) – APCu userland caching<br />
CLI (php-cli) – Command-line interface for PHP<br />
PEAR (php-pear) – PHP Extension and Application Repository framework<br />
PDO (php-pdo) – A database access abstraction module for PHP applications<br />
MySQL (php-mysqlnd) – A module for PHP applications that use MySQL databases<br />
PostgreSQL (php-pgsql) – A PostgreSQL database module for PHP<br />
MongoDB (php-pecl-mongodb) – PHP MongoDB database driver<br />
Redis (php-pecl-redis) – Extension for communicating with the Redis key-value store<br />
Memcache (php-pecl-memcache) – Extension to work with the Memcached caching daemon<br />
Memcached (php-pecl-memcached) – Extension to work with the Memcached caching daemon<br />
GD (php-gd) – A module for PHP applications for using the gd graphics library<br />
XML (php-xml) – A module for PHP applications which use XML<br />
MBString (php-mbstring) – A module for PHP applications which need multi-byte string handling<br />
MCrypt (php-mcrypt) – Standard PHP module provides mcrypt library support</p>
<p>Select what you need: OPcache, APCu, CLI, PEAR, PDO, MySQL, PostgreSQL, MongoDB, Memcache, Memcached, GD, MBString, MCrypt, XML</p>
<p><strong>Install  PHP with all Included  Modules</strong><br />
Fedora 29</p>
<pre class="">dnf install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd
php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached 
php-gd php-mbstring php-mcrypt php-xml

</pre>
<p class=""><strong>Fedora 28</strong></p>
<pre class="">dnf --enablerepo=remi --enablerepo=remi-php72 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml</pre>
<p>&nbsp;</p>
<p><strong>CentOS 7.5/6.10 and Red Hat (RHEL) 7.5/6.10</strong></p>
<pre class="">yum --enablerepo=remi,remi-php72 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml</pre>
<p>&nbsp;</p>
<p><strong>Check PHP version Installed :</strong></p>
<pre class="">[root@osrdarFedora ]# php --version
PHP 7.2.11 (cli) (built: Oct 9 2018 15:09:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.11, Copyright (c) 1999-2018, by Zend Technologies
[root@osrdarFedora ]#</pre>
<p><strong>A.5 Disable and remove  httpd (Apache) server if  installed , Start Nginx HTTP server and PHP-FPM (FastCGI Process Manager)</strong></p>
<p><strong>Stop httpd (Apache)</strong></p>
<pre class="">## Fedora 28/29 and CentOS/RHEL 7.6 ##
systemctl stop httpd.service
systemctl disable httpd.service

## CentOS/RHEL 6.10 ##
service httpd stop
chkconfig httpd off</pre>
<p><strong>Start Nginx</strong></p>
<pre class="">## Fedora 28/29 and CentOS/RHEL 7.6 ##
systemctl start nginx.service

## CentOS/RHEL 6.10 ##
service nginx start</pre>
<p><strong>Start PHP-FPM</strong></p>
<p>## Fedora 28/29 and CentOS/RHEL 7.5 ##<br />
systemctl start php-fpm.service</p>
<p>## CentOS/RHEL 6.10 ##<br />
/etc/init.d/php-fpm start ## use restart after update<br />
## OR ##<br />
service php-fpm start ## use restart after update</p>
<p>1.6 Autostart Nginx and PHP-FPM on boot, also prevent httpd (Apache) autostarting on boot<br />
Prevent httpd (Apache) autostarting on boot</p>
<p>&nbsp;</p>
<p><strong>Autostart Nginx on boot</strong></p>
<pre class="">## Fedora 28/29 and CentOS/RHEL 7.6
systemctl enable nginx.service

## CentOS/RHEL 6.10 ##
chkconfig --add nginx
chkconfig --levels 235 nginx on</pre>
<p><strong>Autostart PHP-FPM on boot</strong></p>
<pre class="">## Fedora 28/9 and CentOS/RHEL 7.6
systemctl enable php-fpm.service

## CentOS/RHEL 6.10 ##
chkconfig --add php-fpm
chkconfig --levels 235 php-fpm on</pre>
<p><strong>A.7 Configure Nginx and PHP-FPM</strong><br />
Latest Fedora Nginx + PHP-FPM builds use custom config, first restore default config</p>
<p><strong>Restore nginx  configs to default</strong></p>
<pre class="">cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
vi /etc/nginx/nginx.conf</pre>
<p>This is how my nginx conf file look like</p>
<pre class="">user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;
#gzip on;

include /etc/nginx/conf.d/*.conf;
}</pre>
<h2>Modify PHP-FPM to listen ip instead of socket ##<br />
vi /etc/php-fpm.d/www.conf</h2>
<pre class="">## Change following   Lines##
;listen = /run/php-fpm/www.sock
listen = 127.0.0.1:9000</pre>
<p>public_html directory  for site Osradar.local</p>
<pre class="">mkdir -p /var/www/osradar.local

chown -R nginx:nginx /var/www/osradar.local</pre>
<p>add logs under /var/log directory.</p>
<pre class="">## public_html directory and logs directory ##
mkdir -p /var/www/osradar.local/
chown -R nginx:nginx /var/www/osradar.local
chown -R nginx:nginx /var/log/nginx</pre>
<p><strong>my  Vhost Configuration File</strong></p>
<p><strong>cat  /etc/nginx/conf.d/osradar.local.conf</strong></p>
<pre class="">server {
    listen         80 default_server;
    listen         [::]:80 default_server;
    server_name     osradar.local;
    root           /var/www/osradar.local;
    index          index.html index.php;

    location / {
      try_files $uri $uri/ =404;
    }

    location ~* \.php$ {
      fastcgi_pass 127.0.0.1:9000;
      include         fastcgi_params;
      fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
      fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
}</pre>
<p><strong>Start  Nginx</strong></p>
<pre class="">Fedora 28/29 and CentOS/RHEL 7.6 ##
systemctl restart nginx.service 


## CentOS/RHEL 6.10 ##
service nginx restart</pre>
<p>Add your testsite.local “domain” to /etc/hosts file</p>
<p>/etc/hosts file Nginx on same machine</p>
<pre class="">127.0.0.1 localhost.localdomain localhost 
192.168.2.98 osradar.local</pre>
<p><strong>A.8 Test your Nginx and PHP-FPM setup</strong></p>
<p>Create /var/www/osradar.local/test.php file with following content:</p>
<pre class=""><!--?php &lt;br ?--> &lt;?php phpinfo(); ?&gt;</pre>
<p>Note:<br />
If you get 403 forbidden error, then you probably have problem with SELinux, then run simply following command:</p>
<pre>chcon -R -t httpd_sys_content_t /var/www/osradar.local/</pre>
<p>## Or some apps might need httpd_sys_rw_content_t ##</p>
<pre class="">chcon -R -t httpd_sys_rw_content_t /var/www/osradar.local/</pre>
<p><strong>B.0  (Open Port 80 on Iptables Firewall)</strong></p>
<p>vi /etc/sysconfig/iptables</p>
<p>Add following INPUT rule:</p>
<p>-A INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 80 -j ACCEPT</p>
<p><strong>B.1 Restart Iptables Firewall:</strong></p>
<pre class="">service iptables restart

</pre>
<p><strong>B.2. Fedora 28/29 and CentOS/Red Hat (RHEL) 7.6</strong></p>
<p><strong>B.2.1 Add New </strong>http<strong> Rule to </strong>Firewalld</p>
<pre class="">firewall-cmd --permanent --zone=public --add-service=http</pre>
<p><strong>B.2.2 Restart </strong>firewalld<strong>.service</strong></p>
<pre>systemctl restart firewalld.service</pre>
<p>3. Test remote connection</p>
<p>Access following address, with your browser. http://osradar.local/</p>
<p>note: i have already crated index.html with the text showing bellow on /var/www/osradar.local/index.html</p>
<p><img loading="lazy" class="alignnone size-full wp-image-7260" src="https://www.osradar.com/wp-content/uploads/2018/11/X1.png" alt="" width="900" height="463" srcset="https://www.osradar.com/wp-content/uploads/2018/11/X1.png 900w, https://www.osradar.com/wp-content/uploads/2018/11/X1-300x154.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/X1-768x395.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/X1-696x358.png 696w, https://www.osradar.com/wp-content/uploads/2018/11/X1-816x420.png 816w" sizes="(max-width: 900px) 100vw, 900px" /></p>
<p>Test PHP   conf file http://osradar.local/test.php</p>
<p><img loading="lazy" class="alignnone size-full wp-image-7261" src="https://www.osradar.com/wp-content/uploads/2018/11/X2.png" alt="" width="1447" height="631" srcset="https://www.osradar.com/wp-content/uploads/2018/11/X2.png 1447w, https://www.osradar.com/wp-content/uploads/2018/11/X2-300x131.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/X2-768x335.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/X2-1024x447.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/X2-696x304.png 696w, https://www.osradar.com/wp-content/uploads/2018/11/X2-1068x466.png 1068w, https://www.osradar.com/wp-content/uploads/2018/11/X2-963x420.png 963w" sizes="(max-width: 1447px) 100vw, 1447px" /> <img loading="lazy" class="alignnone size-full wp-image-7262" src="https://www.osradar.com/wp-content/uploads/2018/11/X3.png" alt="" width="1449" height="774" srcset="https://www.osradar.com/wp-content/uploads/2018/11/X3.png 1449w, https://www.osradar.com/wp-content/uploads/2018/11/X3-300x160.png 300w, https://www.osradar.com/wp-content/uploads/2018/11/X3-768x410.png 768w, https://www.osradar.com/wp-content/uploads/2018/11/X3-1024x547.png 1024w, https://www.osradar.com/wp-content/uploads/2018/11/X3-696x372.png 696w, https://www.osradar.com/wp-content/uploads/2018/11/X3-1068x570.png 1068w, https://www.osradar.com/wp-content/uploads/2018/11/X3-786x420.png 786w" sizes="(max-width: 1449px) 100vw, 1449px" /></p>
<p>Please  let us know if you still have any issues so that we can solve it together. Enjoy</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-nginx-with-php-7-2-10-and-php-fpm-on-fedora-29-and-rhel-centos-7-6/">Install Nginx with PHP 7.2.10 and PHP-FPM on Fedora 29  and RHEL/Centos 7.6</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/install-nginx-with-php-7-2-10-and-php-fpm-on-fedora-29-and-rhel-centos-7-6/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
