`
wcj10051891
  • 浏览: 25633 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类

编译安装php

 
阅读更多

1.安装libxml devel版  yum install libxml2-devel.x86_64

2.下载php源码

3.之前先安装apache2,且--enable-so,

./configure --prefix=/software/php5.5.15 --with-config-file-path=/software/php5.5.15/config --with-mysql=/software/mysql-5.6.20 --with-mysqli=/software/mysql-5.6.20/bin/mysql_config --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --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=/software/httpd2.4/bin/apxs

 

编辑apache配置文件conf/httpd.conf

增加(按上述编译会自动添加)

LoadModule php5_module modules/libphp5.so

 

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

 

动态添加php插件支持

到php源码目录下的ext目录中找到相应的插件,进入目录执行

 

 /usr/local/php5/bin/phpize 

然后configure

./configure --with-php-config=/usr/local/php5/bin/php-config

然后make && make install

 

会在这个插件源码目录下modules文件夹中生成编译后的so文件,

cp到php安装目录下的extensions中,/usr/local/php5/lib/php/extensions

 

 cp /root/download/php-5.5.4/ext/zlib/modules/zlib.so /usr/local/php5/lib/php/extensions

 

编辑php.ini,若编译php时候没有默认生成php.ini, 则去编译时候添加了的configfilepath中新建一个

 --with-config-file-path=/usr/local/php5/conf     这个目录下新建php.ini

 

加入

extension_dir="/usr/local/php5/lib/php/extensions"

extension=zlib.so

 

重启apache

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics