2015-02-20 wcdj
摘要:Ubuntu14.04配置php-5.6.6开发环境,本文使用源码编译的方法,如果是Ubuntu系统也可以通过apt-get install php5来完成,但是通过apt-get安装的版本有可能不是最新的。
1, 安装php
版本说明:
The PHP development team announces the immediate availability of PHP 5.6.6. This release fixes several bugs and addresses CVE-2015-0235 and CVE-2015-0273. All PHP 5.6 users are encouraged to upgrade to this version.
For source downloads of PHP 5.6.6 please visit our downloads page, Windows binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
下载php
wget http://cn2.php.net/distributions/php-5.6.6.tar.gz
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
--with-apxs2=FILE Build shared Apache 2.0 Handler module. FILE is the optional
pathname to the Apache apxs tool apxs
make && make install
2, 修改apache的配置(httpd.conf)
将index.php添加到apache的DirectoryIndex指令中。
注意:修改配置后需要重启apache服务
/usr/local/apache2/bin/apachectl restart
3, 可能遇到的错误
(1) configure错误:configure: error: xml2-config not found. Please check your libxml2 installation
解决方法:sudo apt-get install libxml2-dev
(2) apache启动做错:
./apachectl restart
Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
解决方法:
重新编译apache:
./configure --enable-so --with-mpm=prefork && make && make install
This section contains notes and hints specific to Apache 2.x installs of PHP on Unix systems.
http://php.net/manual/en/install.unix.apache2.php
http://php.net/manual/en/faq.installation.php#faq.installation.apache2
http://php.net/manual/en/install.php
4, 测试php
http://104.131.173.242:8081/