php安装
1、安装包下载
wget https://www.php.net/distributions/php-7.4.10.tar.gz
2、依赖软件安装
yum install openssl-devel libxml2-devel bzip2-devel \
libcurl-devel libjpeg-devel libpng-devel freetype-devel \
libmcrypt-devel recode-devel libicu-devel libzip-devel\
libxml2-devel sqlite-devel bzip2-devel libcurl-devel libicu-devel
3、rpm包安装
yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-6.8.2-1.el7.x86_64.rpm
yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
4、解压php-7.4.10.tar.gz tar -zxvf php-7.4.10.tar.gz
5、 进入php-7.4.10目录
./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --mandir=/usr/local/php/php/man --with-config-file-path=/usr/local/etc/cgi --with-mhash --with-openssl --with-mysqli --with-pdo-mysql --enable-gd --with-iconv --with-zlib --with-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --with-gettext --enable-session --with-curl --with-jpeg --with-freetype --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --without-gdbm --disable-fileinfo
warning:中间可能遇到 No package 'libzip' found,原因是libzip没有安装或者版本太低
解决方法:
yum remove libzip (卸载当前的libzip)
下载新版本的libzip
wget https://libzip.org/download/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make && make install
最后添加PKG_CONFIG_PATH变量
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
6、重新执行第5步
7、make && make install
ok,到此php7.4.10已安装成功
8、php -version
warning:中间可能遇到-bash: php: command not found
解决方法:
添加php环境变量
export PATH=$PATH:/usr/local/php/bin
9、启动php-fpm service php-fpm start
warning:中间可能会遇到 Unit php-fpm.service could not be found
解决方法:
find / -name init.d.php-fpm 查找php-fpm执行文件
cp /usr/local/src/php-7.4.10/sapi/fpm/init.d.php-fpm /etc/i