centos 下 php7.4 安装

参考版本 

https://www.cnblogs.com/liubaoqing/p/12176017.html

 下载

wget https://www.php.net/distributions/php-7.4.21.tar.gz
tar -zxvf php-7.4.0.tar.gz

 安装配置

./configure  
--prefix=/abc/server/php74
--with-config-file-path=/abc/server/php74/etc
--with-config-file-scan-dir=/abc/server/php74/etc/php.d
--with-fpm-user=www
--with-fpm-group=www
--enable-fpm
--enable-sockets
--enable-soap
--enable-session
--enable-opcache
--enable-mysqlnd
--enable-mbstring
--enable-gd
--with-curl
--with-openssl
--with-openssl-dir=/usr/local/ssl
--with-mhash
--with-mysqli
--with-pdo-mysql
--with-pdo-sqlite
--with-iconv
--with-iconv-dir
--with-zlib
--with-gettext
--with-kerberos
--with-libdir=lib64
--with-pear
--with-xmlrpc
--with-xsl
--with-zip
--with-bz2
--enable-bcmath
--enable-pcntl

CentOS 7编译安装PHP 7.4提示No package 'libzip' found或者(libzip >= 0.11)

https://www.jianshu.com/p/d01665bfa4eb   https://www.jeeinn.com/2020/06/1319/  另一种解决方法,没尝试

注意安装版本,当前 1.8 需要 更多依赖。此处选择低版本

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

安装后,可能还是无法找到

export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"

PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library) 'pdo_mysql' in Unknown on line 0

 https://blog.csdn.net/tornge/article/details/51388233 

php7 ,pdo都是默认安装的

资料原来是php.ini中关于mysql的socket路径的问题

根据 /etc/my.cnf

datadir = /data/vdb1/mysql

修改 php.ini

pdo_mysql.default_socket=/data/vdb1/mysql/mysql.sock



医学我的剑,编程我的酒。 仗剑走天涯,偶尔喝喝酒。
原文地址:https://www.cnblogs.com/mitang/p/14986619.html