编译装配php

WBOY
WBOYOriginal
2016-06-13 12:36:11716browse

编译安装php

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

2.下载php源码

3.之前先安装apache2,且--enable-so,./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php5/conf --with-mysql

?

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

增加

LoadModule php5_module modules/libphp5.so

?


??? SetHandler application/x-httpd-php

?

动态添加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

?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn