php 5.6.34 安装,centos6编译安装 php5.6.34,并mod_php方式整合apache

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

./configure \

--prefix=/usr/local/php5.6.34 \

--with-config-file-path=/usr/local/php5.6.34/etc \

--with-apxs2=/usr/local/apache2/bin/apxs \

--with-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-iconv-dir \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-libxml-dir \

--enable-xml \

--disable-rpath \

--enable-bcmath \

--enable-shmop \

--enable-sysvsem \

--enable-inline-optimization \

--with-curl \

--with-mcrypt \

--enable-mbregex \

--enable-mbstring \

--with-gd \

--enable-gd-native-ttf \

--with-openssl \

--with-mhash \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-zip \

--enable-soap \

--without-pear \

--with-gettext

--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 Groupwww

4

5

6

7

8 DirectoryIndex index.php index.html index.htm

9

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(); 页面测试正常

74c95ac693bb2a4f2ee36ee418b30afa.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值