centos6.5(update到6.9,2.6.32-696.16.1.el6.x86_64 )已安装apache2.2.34和mysql5.1.72
一:安装依赖,部分依赖已在安装apache和mysql时安装
yum install -y libxml2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel pcre-devel bzip2-devel
二:编译参数
如果使用PHP5.3以上版本,为了链接MySQL数据库,可以指定mysqlnd,这样在本机就不需要先安装MySQL或MySQL开发包了。mysqlnd从php 5.3开始可用,可以编译时绑定到它(而不用和具体的MySQL客户端库绑定形成依赖),但从PHP 5.4开始它就是默认设置了。
如果之前已经编译过php,先执行一下make clean
--with-apxs2=/usr/local/apache2/bin/apxs 这一行指定使用使用mod_php方式和apache整合。
编译成功会有以下内容
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
三:make &&make install
*****************************
整合apache
编辑httpd.conf, 修改以下内容(红色标注)
vim /usr/local/apache2/conf/httpd.conf
1 User www 3 Group www 4 5 6 7 <IfModule dir_module> 8 DirectoryIndex index.php index.html index.htm 9 </IfModule> 10 11 12 13 AddType application/x-compress .Z 14 AddType application/x-gzip .gz .tgz 15 16 AddType application/x-httpd-php .php .phtml 17 AddType application/x-httpd-php-source .phps
用 phpinfo(); 页面测试正常