wget https://www.php.net/distributions/php-7.3.27.tar.gz
tar -zxvf php-7.3.27.tar.gzcd php-7.3.27
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --enable-soap --enable-mbstring --enable-sockets --enable-exif
报错:configure: error: Please reinstall the BZip2 distribution,需要安装扩展:
yum --y install bzip2 bzip2-devel
报错:configure: error: png.h not found.,这个是选择安装GD模块才会出现的错误,需要安装扩展:
yum -y install libpng libpng-devel
报错:configure: error: freetype-config not found.,需要安装扩展:
yum -y install freetype-devel
总的来说就是缺少什么扩展,装上就好!
make
报错:libtool: warning: remember to run 'libtool --finish /usr/local/src/php-7.3.27/libs,安装扩展:
yum -y install libtool libtool-ltdl-devel
之后先清理一下make的缓存,然后再执行安装命令:
make clean
又报错:libtool: link: `ext/date/php_date.lo’ is not a valid libtool object,这个错在网上找了很久,都说的是make clean之后就不会再出现了,但是我试了两次还是一样,第三次才好的。。。
继续往下执行:
make install
这里会有警告:warning: remember to run ‘libtool --finish /usr/local/src/php-7.3.27/libs’,实际对php安装是没有问题的,直接运行看apac和模块下是否有php7即可:
/usr/local/apache2/bin/httpd -M
可以看到:php7_module (shared),就说明PHP安装没有问题了!
在apahce默认访问目录(DocumentRoot 配置的目录)加一个index.php文件,访问一下看是否可以解析出php代码即可!
(如有更好的意见,请留言讨论!)
上一篇:10个时髦搭配法则,太值得借鉴了 10个时髦搭配法则,太值得借鉴了
下一篇:迪丽热巴新剧开机晒美照,嘟嘴卖萌甜如少女,和黄景瑜再传绯闻 迪丽热巴新剧开机晒美照,嘟嘴卖萌甜如少女,和黄景瑜再传绯闻