The added library file path must be consistent with the system platform arch. For 32bit systems, just add [/usr/local/lib] directly. For 64bit systems, add [/usr/local/lib64.] Otherwise The error will still be reported. This article will introduce in detail how to install PHP7 under centos7.
1. Official website installation method:
http://php.net/manual/zh /install.unix.nginx.php
Related learning recommendations: PHP Programming from beginner to master
2. Compile and install
1. Download php7
wget -O php7.tar.gz http://cn2.php.net/get/php-7.1.20.tar.gz/from/this/mirror
or download directly from the webpage
http://php.net/get/php-7.1.20.tar.gz/from/a/mirror
2. Unzip php7
tar -xvf php7.tar.gz
3. Enter the php directory
cd /usr/local/src/php-7.1.20
4. Install dependency packages
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
5. Compile configuration (If an error occurs, it is basically caused by the dependency files in the previous step not being installed)
./configure \ --prefix=/software/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
Error reporting
The most practical solution is as follows:
Problem:
1: wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
2: tar zxf libmcrypt-2.5.7.tar.gz
3: ./configure --prefix=/usr/local
4: make && make install
Problem: configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no
Solution: Solution:
vim /etc/ld.so.conf.d/local.conf
# Edit the library file
/usr/local/lib
# Add this line
ldconfig -v
# Make it take effect
Note:
The library file path added here must be consistent with your system platform arch, 32bit system directly Just add /usr/local/lib
. For 64bit systems, you need to add /usr/local/lib64
. Otherwise, an error will still be reported. I just added /usr/ local/lib
could not be edited alive and well, but it was later changed to /usr/local/lib64
.
6. Formal installation
make && make install
7. Configuration Environment variables
vi /etc/profile PATH=$PATH:/usr/local/php/bin export PATH source /etc/profile
8. 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 /usr/local/php/etc/php-fpm chmod +x /usr/local/php/etc/php-fpm ln /usr/local/php/etc/php.ini /etc/php.ini
9. Create www user
useradd www
10. Configure startup parameters
vim /usr/local/php/etc/php-fpm.d/www.conf pm.max_children = 500 pm.start_servers = 105 pm.min_spare_servers = 10 pm.max_spare_servers = 200
11.Start php-fpm
/usr/local/php/etc/php-fpm start 设置 php-fpm开机启动 cp /usr/local/src/php-5.5.14/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #拷贝php-fpm到启动目录 chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限 chkconfig php-fpm on #设置开机启动 service php-fpm start pkill php-fpm 强制关闭
The above is the detailed content of How to install PHP7 under centos7?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software