centos6.5源码安装php5.6.9
时间:2015-06-09 03:21 来源:linux.it.net.cn 作者:IT
-
下载php5.6.9包并解压
-
编译安装
-
谢天谢地,只报了一个错误,有的错误可以参阅http://www.jb51.net/article/37487.htm这位大哥写的文章
-
解决与httpd的联系,如果启动不了,请把自己的防火墙和selinux关掉哦
a)在指定行添加 AddType application/x-httpd-php .php .phtml
b)在指定行修改 DirectoryIndex index.html index.php
-
测试php是否正常运行
修改网页主页为Index.php,把之前的index.html备份或者删除
[root@localhost htdocs]# cat index.php
<html>
<body>
<h1>it works!</h1>
</body>
</html>
<?php
phpinfo();
?>
具体我不截图了,很多之前编译加载的模块被enabled,可以使用
-
测试与mysql的连接
[root@localhost htdocs]# cat index.php
if ($conn)
echo "success!";
else
echo "failure!";
?>
-
安装php的xcache3.0(负责加速解析php代码)扩展
下载安装包,编译安装
下面这部分,针对php5.4可用
[root@localhost ~]# wgethttp://xcache.lighttpd.net/pub/Releases/3.0.1/xcache-3.0.1.tar.gz
[root@localhost ~]# tar xf xcache-3.0.1.tar.gz
[root@localhost ~]# cd xcache-3.0.1
[root@localhost xcache-3.0.1]# /usr/local/php/bin/phpize #phpize是准备一个php扩展准备编译,第一层次的检查
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
编译指定哪个扩展(xcache),php-config是负责解析这个扩展并编译的,相当于检阅吧
[root@localhost xcache-3.0.1]# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
[root@localhost xcache-3.0.1]# make&&make install
/root/xcache-3.0.1/xcache.c: In function 'zif_xcache_get_special_value':
/root/xcache-3.0.1/xcache.c:324: error: 'IS_CONSTANT_ARRAY' undeclared (first use in this function)
/root/xcache-3.0.1/xcache.c:324: error: (Each undeclared identifier is reported only once
/root/xcache-3.0.1/xcache.c:324: error: for each function it appears in.)
make: *** [xcache.lo] Error 1
上面的内容会报错,原因是php5.6 xcache3.0并不支持,所以官网下载最新版,所以还是多去官网或权威网站比较好
[root@localhost ~]# wgethttp://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz
(责任编辑:IT)
|
