https://www.php.net/distributions/php-7.2.20.tar.gz
tar -xzvf php-7.2.20.tar.gz
mv php-7.2.20 php
二.配置和创建PHP
./configure --with-apxs2=/usr/local/apache2/bin/apxs
执行该语句时可能会出现如下提示:
error: xml2-config not found. Please check your libxml2 installation
此时执行make命令会出现以下错误:
“make: *** No targets specified and no makefile found. Stop.”
这是因为缺少xml2-config文件造成的。解决方案:
sudo apt-get install libxml2
sudo apt-get install libxml2-dev
之后在此执行以下语句完成编译安装
./configure --with-apxs2=/usr/local/apache2/bin/apxs #指定Apache2−−with−apxs2=/usr/local/apache2/bin/apxs——指定Apache2
make
make install
、安装时报错内存 不足recipe for target 'ext/fileinfo/libmagic/apprentice.lo' failed,把服务器应用全关了 重新安装ok
4.将php.ini拷贝到/usr/local/lib/
cp php.ini-development /usr/local/lib/php.ini
5.编辑httpd.conf,加载PHP模块
LoadModule php7_module modules/libphp7.so #好像程序自己加进去了
6.在httpd.conf文件的对应标签下添加如下语句
DirectoryIndex index.html index.php index.htm
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType applicaiton/x-httpd-php-source .phps
7.重启Apache2
/usr/local/web/apache2/bin/apachectl restart
1
8.测试PHP是否安装成功
在Apache2的指定文件目录下添加index.php文件,并输入以下内容
phpinfo();
?>
、
然后在浏览器输入url——localhost/index.php,如果查看到以下结果,则说明安装成功,若没有,可以考虑重新编译安装。
标签:index,tar,php7.2,gz,usr,apache2,php,local
来源: https://www.cnblogs.com/jiangfeilong/p/11143698.html