<?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>systemctl &#8211; VeriTeknik</title>
	<atom:link href="https://www.veriteknik.net.tr/en/tag/systemctl/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.veriteknik.net.tr/en/</link>
	<description>VeriTeknik Bilişim &#124; VeriTeknik Bilişim</description>
	<lastBuildDate>Sat, 03 Jul 2021 16:20:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>PHP 7 on CentOS 7 with PHP-FPM</title>
		<link>https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm-2/</link>
					<comments>https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm-2/#respond</comments>
		
		<dc:creator><![CDATA[ckaraca]]></dc:creator>
		<pubDate>Sun, 07 Jun 2020 20:46:37 +0000</pubDate>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[freetds]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[PHP 5.6]]></category>
		<category><![CDATA[PHP 5.6.3]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[systemctl]]></category>
		<category><![CDATA[systemd]]></category>
		<guid isPermaLink="false">http://www.plugged.in/?p=1053</guid>

					<description><![CDATA[<p>Most of the yum repositories don&#8217;t include PHP7.0.X on current releases for the time being. So if you need PHP7.0.X, you need to compile and build it for your self. I decided to put all required packages to the compilation, so most probably you wouldn&#8217;t need additional packages, just a quick tip, if you need [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm-2/">PHP 7 on CentOS 7 with PHP-FPM</a> appeared first on <a rel="nofollow" href="https://www.veriteknik.net.tr/en/">VeriTeknik</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Most of the yum repositories don&#8217;t include PHP7.0.X on current releases for the time being. So if you need PHP7.0.X, you need to compile and build it for your self. I decided to put all required packages to the compilation, so most probably you wouldn&#8217;t need additional packages, just a quick tip, if you need additional packages you can install via pecl or pear tools.</p>
<h3>Which PHP configure options should I use before compiling?</h3>
<p>If you ever need to get the list of modules installed in your current PHP, type the following command via console:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="shell">php -m</pre>
<p>So, take a list of your current configuration and check the configure list below in order to have a compatible compilation to your existing older version of PHP.</p>
<p>Advice: First of all, you should consider removing PHP packages from your server before compiling PHP, but be aware your codes will be visible till you install the compiled version to your server, consider shutting down your apache server for a while.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">yum erase php*</pre>
<p>Before downloading the code, install &#8220;Development Tools&#8221; by typing:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">yum groupinstall "Development Tools"</pre>
<p>and install other related header files:</p>
<pre class="brush: shell; gutter: true; first-line: 1">yum install wget httpd-devel libtool-ltdl-devel libxml2-devel \
bzip2-devel net-snmp-devel openssl-devel pcre-devel \
curl-devel gd-devel mysql-devel libxslt-devel \
postgresql-devel gmp-devel systemd-devel</pre>
<p>Download &amp; install libmcrypt</p>
<pre class="brush: shell; gutter: true; first-line: 1">cd /usr/src
wget http://downloads.sourceforge.net/project\
/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz 
cd libmcrypt-2.5.8
./configure -libdir=/usr/lib64
make
make install</pre>
<p> </p>
<p>Download &amp; extract PHP 7.0.4 release:</p>
<pre class="brush: shell; gutter: true; first-line: 1">wget http://php.net/get/php-7.0.4.tar.gz/from/this/mirror
mv mirror /usr/src/php-7.0.4.tar.gz
cd /usr/src/
tar zxvf /usr/src/php-7.0.4.tar.gz 
cd php-7.0.4
./configure \
 --with-apxs2 \
 --with-curl=/usr/local/lib \
 --with-config-file-path=/etc \
 --with-config-file-scan-dir=/etc/php.d \
 --with-pic \
 --with-gd \
 --with-gettext \
 --with-jpeg-dir=/usr/local/lib \
 --with-freetype-dir=/usr/local/lib \
 --enable-sockets \
 --with-kerberos \
 --with-openssl \
 --with-mhash \
 --with-mcrypt=/usr/local/lib \
 --with-mysqli=/usr/bin/mysql_config \
 --with-pdo-mysql=/usr \
 --with-pdo-pgsql=/usr \
 --with-pcre-regex=/usr \
 --with-pear \
 --with-gmp \
 --with-pgsql \
 --with-png-dir=/usr/local/lib \
 --with-xsl \
 --with-zlib \
 --with-zlib-dir=/usr/local/lib \
 --with-iconv \
 --with-libxml-dir=/usr \
 --enable-bcmath \
 --enable-calendar \
 --enable-exif \
 --enable-ftp \
 --enable-gd-native-ttf \
 --enable-soap \
 --enable-sockets \
 --enable-mbstring \
 --enable-zip \
 --enable-wddx \
 --enable-shmop \
 --with-libdir=lib64 \
 --disable-debug \
 --with-bz2 \
 --enable-gd-native-ttf \
 --enable-xml \
 --with-snmp=/usr \
 --enable-json \
 --with-fpm-user=apache\
 --with-fpm-group=apache\
 --enable-fpm \
 --with-fpm-systemd
</pre>
<p>Make &amp; Install by typing:</p>
<pre class="brush: shell; gutter: true; first-line: 1">make
make install
cp php.ini-production /etc/php.ini
</pre>
<p>Run the following to enable systemd service for PHP:</p>
<pre class="brush: bash; gutter: true; first-line: 1">cat &lt;&lt;&lt; '
[Unit]
Description=The PHP FastCGI Process Manager - VeriTeknik
After=syslog.target network.target

[Service]
Type=notify
PIDFile=/var/run/php-fpm.pid
ExecStart=/usr/local/sbin/php-fpm --nodaemonize \
--fpm-config /etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target
' &gt; /usr/lib/systemd/system/php-fpm.service
systemctl enable php-fpm
</pre>
<p>Get rid of obsolete settings:</p>
<pre class="brush: shell; gutter: true; first-line: 1">sed -i 's#;date.timezone =.*#  date.timezone = "Europe/Istanbul"#' /etc/php.ini
sed -i 's#upload_max_filesize =.*#upload_max_filesize = 200M#' /etc/php.ini
sed -i 's#post_max_size =.*#post_max_size = 200M#' /etc/php.ini
cat &lt;&lt;&lt; ' include=/etc/php-fpm.d/*.conf [global] pid = \ 
/run/php-fpm/php-fpm.pid error_log = /var/log/php-fpm/error.log \
daemonize = no ' &gt; /etc/php-fpm.conf
mkdir /etc/php-fpm.d
</pre>
<p> </p>
<p>You need to create the appropriate user account the fpm process will run on, as a sample, we use <strong>plugged</strong> as a user:</p>
<pre class="brush: shell; gutter: true; first-line: 1">useradd plugged
chmod 755 /home/plugged</pre>
<p>create the php-fpm process config for the specific site:</p>
<pre class="brush: shell; gutter: true; first-line: 1">cat &lt;&lt;&lt; '
[www]
listen = 127.0.0.1:9001
 
listen.allowed_clients = 127.0.0.1
listen.owner = plugged
listen.group = plugged
user = plugged
group = plugged
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35

slowlog = /var/log/php-fpm/www-slow.log
 
catch_workers_output = yes
 
php_admin_value[error_log] = /home/plugged/logs/mphp_error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path] = /home/plugged/session
' &gt; /etc/php-fpm.d/plugged.conf

mkdir /run/php-fpm/
mkdir /var/log/php-fpm/
touch /var/log/php-fpm/error.log
mkdir {/home/plugged/logs/,/home/plugged/session}
chown -R plugged:plugged /home/plugged
systemctl start php-fpm
sed -i 's/DirectoryIndex index.html.*/  DirectoryIndex index.html index.html.var index.php/' /etc/httpd/conf/httpd.conf</pre>
<p>please let us know if you find any mistake</p>


<p></p>
<p>The post <a rel="nofollow" href="https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm-2/">PHP 7 on CentOS 7 with PHP-FPM</a> appeared first on <a rel="nofollow" href="https://www.veriteknik.net.tr/en/">VeriTeknik</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1053</post-id>	</item>
		<item>
		<title>PHP 7 on CentOS 7 with PHP-FPM</title>
		<link>https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm/</link>
					<comments>https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm/#respond</comments>
		
		<dc:creator><![CDATA[ckaraca]]></dc:creator>
		<pubDate>Wed, 18 Sep 2019 20:57:42 +0000</pubDate>
				<category><![CDATA[LINUX]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[freetds]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[PHP 5.6]]></category>
		<category><![CDATA[PHP 5.6.3]]></category>
		<category><![CDATA[php-fpm]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[systemctl]]></category>
		<category><![CDATA[systemd]]></category>
		<guid isPermaLink="false">http://www.plugged.in/?p=1076</guid>

					<description><![CDATA[<p>Most of the yum repos doesn&#8217;t include PHP7.0.X on current releases for the time being. So if you need PHP7.0.X, you need to compile and build it for your self or you need to add additional repos to yum, which will be much more easier and much more flexible to update later. So, on a [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm/">PHP 7 on CentOS 7 with PHP-FPM</a> appeared first on <a rel="nofollow" href="https://www.veriteknik.net.tr/en/">VeriTeknik</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Most of the yum repos doesn&#8217;t include PHP7.0.X on current releases for the time being. So if you need PHP7.0.X, you need to compile and build it for your self or you need to add additional repos to yum, which will be much more easier and much more flexible to update later. So, on a clean installed server proceed with the installation of Epel and Remi repos, in case you don&#8217;t have wget, also install it:</p>
<pre class="brush: bash; gutter: true; first-line: 1">yum install epel-release
yum install net-tools, bind-utils # optional life savers 
rpm -Uvh http://mirror.veriteknik.net.tr/remi/enterprise/remi-release-7.rpm
yum install php70-php-fpm php70-php-cli php70-php-gd php70-php-json \
php70-php-mbstring php70-php-mcrypt php70-php-mysqlnd php70-php-xml
yum install nginx</pre>
<p>&nbsp;<br />
Please note that if you need additional PHP packages, you can search them with the following command:</p>
<pre class="brush: bash; gutter: true; first-line: 1">yum list php70-*
#Available Packages
#php70-php-opcache.x86_64
#.
#.
#php70-php-pecl-crypto.x86_64
#php70-php-pecl-geoip.x86_64 
#php70-php-pecl-imagick.x86_64
#php70-php-pecl-memcache.x86_64
#php70-php-pecl-xdebug.x86_64
#php70-php-pgsql.x86_64
#php70-php-soap.x86_64
#php70-php-xmlrpc.x86_64
#..
# and to install a package you desire, type the name:
yum install php70-php-pgsql
</pre>
<p>Run the following to enable systemd service for PHP-FPM:</p>
<pre class="brush: bash; gutter: true; first-line: 1">systemctl enable php70-php-fpm
systemctl enable nginx</pre>
<p>Disable SELINUX, set to disabled:</p>
<pre class="brush: bash; gutter: true; first-line: 1">vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
<strong>SELINUX=disabled</strong>
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted</pre>
<p>type SHIFT+ZZ to save and exit, and for the time beign type setenforce 0 to disable SELINUX temproray.<br />
Next step is to get rid of obsolete settings:</p>
<pre class="brush: shell; gutter: true; first-line: 1">sed -i 's#;date.timezone =.*# &nbsp;date.timezone = \ 
"Europe/Istanbul"#' /etc/opt/remi/php70/php.ini
sed -i 's#upload_max_filesize =.*#upload_max_filesize = \
200M#' /etc/opt/remi/php70/php.ini
sed -i 's#post_max_size =.*#post_max_size = \
200M#' /etc/opt/remi/php70/php.ini

</pre>
<p>You need to create the appropriate user account the fpm process will run on, as a sample we use <strong>plugged</strong> as a user:</p>
<pre class="brush: shell; gutter: true; first-line: 1">useradd plugged
chmod 755 /home/plugged
mkdir /home/plugged/{logs,public_html,session}
touch /home/plugged/logs/{mphp_error.log,php-fpm-slow.log}
chown -R vtt:vtt /home/plugged/public_html/</pre>
<p>create the php-fpm process config for the specific site:</p>
<pre class="brush: shell; gutter: true; first-line: 1">cat &lt;&lt;&lt; '[plugged] 
listen = 127.0.0.1:9001
listen.allowed_clients = 127.0.0.1 
listen.owner = plugged 
listen.group = plugged 
user = plugged 
group = plugged 
pm = dynamic 
pm.max_children = 50 
pm.start_servers = 5 
pm.min_spare_servers = 5 
pm.max_spare_servers = 35 
slowlog = /home/plugged/logs/php-fpm-slow.log 
catch_workers_output = yes 
php_admin_value[error_log] = /home/plugged/logs/mphp_error.log 
php_admin_flag[log_errors] = on 
php_value[session.save_handler] = files 
php_value[session.save_path] = /home/plugged/session ' \
&gt; /etc/opt/remi/php70/php-fpm.d/plugged.conf
</pre>
<p>Turn on PHP-FPM by typing:</p>
<pre class="brush: shell; gutter: true; first-line: 1">systemctl start php70-php-fpm.service
</pre>
<p>If it fails to start, you can check the logs by typing<br />
systemctl status php70-php-fpm.service</p>
<p>Also please check the service is running by typing netstat so if the port is open, you should see that:</p>
<pre class="brush: shell; gutter: true; first-line: 1">netstat -tulpn | grep php-fpm
#tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      908/php-fpm: master 
#tcp        0      0 127.0.0.1:9001          0.0.0.0:*               LISTEN      908/php-fpm: master 
</pre>
<p>please let us know if you find any mistake</p>
<p>The post <a rel="nofollow" href="https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm/">PHP 7 on CentOS 7 with PHP-FPM</a> appeared first on <a rel="nofollow" href="https://www.veriteknik.net.tr/en/">VeriTeknik</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.veriteknik.net.tr/en/php-7-on-centos-7-with-php-fpm/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1076</post-id>	</item>
	</channel>
</rss>
