Source configuration PHP7.4

Posted by Pyrite on Thu, 21 May 2020 17:55:26 +0200

1, php Installation Preparation Environment

System: CentOS Linux release 7.7.1908 
PHP: php-7.4.6

2, Install PHP dependency package

    yum install gcc 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

3, Download 7.4tar software package on the official website

https://www.php.net/distributions/

tar -xzf php-7.4.6.tar.gz
cd php-7.4.6
./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-fpm --with-fpm-user=www  --with-fpm-group=www --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.


No package 'oniguruma' found:
resolvent:

yum install http://rpms.remirepo.net/enterprise/7/remi/x86_64//oniguruma5-6.9.4-1.el7.remi.x86_64.rpm
yum install http://rpms.remirepo.net/enterprise/7/remi/x86_64//oniguruma5-devel-6.9.4-1.el7.remi.x86_64.rpm 

Continue compiling:

make
make install

After compiling, we add PHP command to environment variable

vim  /etc/profile

Add at the end of the file:

PATH=$PATH:/usr/local/php/bin
export PATH

For changes to take effect immediately

source /etc/profile

View PHP version

php -v

To configure php:

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/src/php-7.4.6/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chkconfig  --add   php-fpm
chkconfig php-fpm on

4, php-fpm.conf It is one of the important configuration files of php service program. We need to enable the pid file saving directory in line 25 of the configuration file, and then change the user and group parameters in lines 148 and 149 to www account and user group name respectively:

4. After the installation is complete, start the service

 systemctl enable php-fpm.service
 systemctl start php-fpm.service

Topics: Linux PHP OpenSSL yum zlib