linux starts to install web server 1 from 0
linux connects to the Internet -- linux installs web server 2
Installing gcc -- linux installing web server 3
linux install mysql5.6 -- linux install web server 3
After php7.1,
mcrypt series functions are not supported,
Considering that many of my friends used to use mcrypt series of encryption and decryption functions,
So teacher Ziheng chose to install php7.0.27 for demonstration
1, Install php7 dependency
yum 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 pcre-devel
2, Install libmcrypt
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar xzvf libxml2-2.9.7.tar.gz
cd libxml2-2.9.7
./configure --prefix=/usr/local/libmcrypt
make && make install
If the download fails or is slow,
You can add the notes of the student's official account.
Reply to libmcrypt
download
3, Add user group
groupadd www
useradd -r -g www www
4, Install php7.0.27
Download php7
http://at2.php.net/get/php-7.0.27.tar.gz/from/this/mirror
If the download fails or is slow,
You can add the notes of the student's official account.
Reply to php
download
tar -xzvf php php7.0.27.tar.gz
cd php-php7.0.27
./configure \
--prefix=/usr/local/php \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-inline-optimization \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--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-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 \
--disable-debug \
--enable-opcache
make && make install
Description of relevant compilation parameters,
You can view it through. / configure – help
If you are installing php7.2,
WARNING: unrecognized options: - with mcrypt, – enable GD native TTF may be encountered,
Just delete the above two options,
Because it's not supported.
5, Configure PHP FPM
cp php.ini-production /usr/local/php/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/init.d.php-fpm /etc/init.d/php-fpm
6, Set php.ini time zone
vi /usr/local/php/etc/php.ini
date.timezone = "Asia/Shanghai";
7, Start PHP FPM
chmod +x /etc/init.d/php-fpm
/etc/init.d/php-fpm start
8, Add to system path
vi /etc/profile
export PHP_HOME="/usr/local/php"
export PATH="$PATH:$PHP_HOME/bin"
source /etc/profile
9, Check if the installation is successful
php -v
If you see version information similar to the following,
Represents a successful installation.
10, Check whether php starts successfully
ps aux | grep php-fpm
See the following information,
On behalf of startup success