The installation log of Nginx, MariaDB and PHP7

The make && make install of MariaDB is in process, it will take a long time. Let’s take a break.

–So I just write down this log.

To be honest it is very handy to keep such a technical blog, as you can use your blog as a notebook. Lmao.

1.Installing NGINX

You know how it is. Install the compile tools, then dependencies. Download the source pack, unzip, configure, make and install then add to the startup.

Tools and dependencies

yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre-devel

Add user and group

sudo groupadd -r nginx
sudo useradd -s /sbin/nologin -g nginx -r nginx

Download source pack and unzip

No way. Bro. Just go to for the latest version.

Configure, make and make install

./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_v2_module

If you don’t need HTTPS support (Oh come on!),  remove the --with-http_ssl_module

Remember to make && make install

Add to the start up

Save the configuration below into /lib/systemd/system/nginx.service

Description=The NGINX HTTP and reverse proxy server

ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID


2.Installing PHP7


rpm --import 
rpm -Uvh 
yum install epel-release -y

first and you are going to thank me one day.

Tools and dependencies

yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel libc-client-devel

ln -s /usr/lib64/ /usr/lib/

Download source pack and unzip

No way again! Bro. Just go to PHP.NET for the latest version.

Configure, make and make install

go into the folder of your PHP

./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-fpm \
--with-fpm-user=nginx  \
--with-fpm-group=nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared  \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir  \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets  \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache \
--with-imap=imap \
--with-kerberos \

Remember to make && make install

Then vi /etc/profile and add the text below to the bottom of this file.

export PATH

source /etc/profile will make the changes take effect instantly.

Add to the start up

cp php.ini-production /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp sapi/fpm/php-fpm /usr/local/sbin/php-fpm
chmod +x /usr/local/sbin/php-fpm

and edit or create /lib/systemd/system/php-fpm.service

Description=PHP FastCGI process manager nginx.service
ExecStartPre=/bin/mkdir --parents /run/php
ExecStart=/usr/local/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf

Leave a Reply

Your email address will not be published. Required fields are marked *