下载好源码,解压。输入如下命令
./configure --prefix=/usr/local/php74 --with-fpm-user=www --with-fpm-group=www --with-zlib-dir --with-freetype --enable-mbstring --enable-soap --enable-calendar --with-curl --enable-gd --with-jpeg --with-xpm --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --with-pcre-jit --with-pdo-mysql --with-mysqli --with-openssl --enable-ftp --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-fpm --with-iconv --with-pear --with-gnu-ld --enable-static
如遇依赖库缺少请根据系统版本进行安装
make出现ext/iconv/.libs/iconv.o: In function `_php_iconv错误时,手动编辑Makefile,在 EXTRA_LIBS 后面增加-liconv 保存。重新编译即可
记得直接make
make && make install
其他可能需要的扩展
yum install sqlite-devel
sudo yum install oniguruma-devel