1。进入php源码包,执行命令
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/myapache/bin/apxs #把php作为一个模块加载在apache中
sudo make && sudo make install
2。如果编译php提示缺少xml2,可以执行apt-get install libxml2 libxml2-dev
编译完成,查看apache配置文件,会增加一个 libphp7.so
3.apache加入解析php后缀语句
AddType application/x-httpd-php .php
4.启动apache
sudo /usr/local/myapache/bin/apachectl -f /usr/local/myapache/conf/httpd.conf
停止apache
sudo /usr/local/myapache/bin/apachectl stop
时间: 2024-10-17 18:49:14