CentOS-6.8下编译安装php-5.6.23。
下载文件
进入到我们的软件下载位置,并下载文件文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
cd soft/文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
wget http://cn2.php.net/distributions/php-5.6.23.tar.gz文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
安装php-5.6.23
文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
解压文件并进入到解压后的文件夹文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
tar xzf php-5.6.23.tar.gz && cd php-5.6.23文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
文章源自陈学虎-https://chenxuehu.com/article/2016/06/5416.html
./configure检测
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/
报错了
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)
The output of /usr/local/apache/bin/apxs follows:
./configure: /usr/local/apache/bin/apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory
configure: error: Aborting
直接安装解决错误再说,这个错误一般容易错误的解决,正确的解决方式是
vi /usr/local/apache/bin/apxs
将
#!/replace/with/path/to/perl/interpreter -w
改为
#!/usr/bin/perl -w
继续检测,发现还有错误
configure: error: xml2-config not found. Please check your libxml2 installation.
直接安装即可
yum install libxml2 libxml2-devel -y
安装后再次检测,如果不出意外,就应该成功了,如果还有错误,继续解决即可:
接下来就简单了
make && make install
喝杯咖啡去...
喝完咖啡,也安装完成了,我们配置下去:
vi /usr/local/apache/conf/httpd.conf
oadModule php5_module modules/libphp5.so (默认已存在)
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html (把index.php加入index.html之前)
评论