#下载
wget -c https://www.php.net/distributions/php-7.4.33.tar.gz
tar -zxvf php-7.4.33.tar.gz
cd php-7.4.33
#安装依赖
[root@appserver php-7.4.33]# yum -y install gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel
[root@appserver php-7.4.33]# yum -y install openldap-devel openldap-servers openldap-clients
[root@appserver php-7.4.33]# cp -r /usr/lib64/libldap* /usr/lib/
[root@appserver php-7.4.33]# yum install sqlite-devel libwebp-devel libicu-devel
#安装oniguruma与oniguruma-devel
[root@appserver php-7.4.33]# yum install https://rpms.remirepo.net/enterprise/7/remi/x86_64/oniguruma5php-6.9.9-1.el7.remi.x86_64.rpm
[root@appserver php-7.4.33]# yum install https://rpms.remirepo.net/enterprise/7/remi/x86_64/oniguruma5php-devel-6.9.9-1.el7.remi.x86_64.rpm
# 安装libzip
wget https://libzip.org/download/libzip-1.3.2.tar.gz
tar xvf libzip-1.3.2.tar.gz
cd libzip-1.3.2
./configure
make
make install
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
#预编译
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype --with-jpeg --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-ftp --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-webp --with-zip --with-ldap --enable-debug --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-mbstring --with-config-file-path=/usr/local/php/etc --with-zlib-dir --with-openssl-dir=/usr/bin/openssl
make && make install
#在MAKE时如果报错:如果报错/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_memfree',按如下操作:vi Makefile
#找到 开头是 'EXTRA_LIBS' 这一行 在结尾加上 '-llber' 然后执行 make && make install
cp php.ini-development /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
export PATH=$PATH:/usr/local/php/bin
[root@appserver php-7.4.33]# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
/etc/init.d/php-fpm start
源码安装PHP7.4.33开启php-ldap php-zip php-zlib php-gd等模块
于 2023-12-04 09:47:41 首次发布