[root@localhost mysql]# yum -y install "libtool*"
[root@localhost mysql]# yum -y install "libtool-ltdl*"
[root@localhost mysql]# vi /usr/local/gd2/include/gd_io.h
#修改gd_io.h头文件
typedef struct gdIOCtx
{
…
void (*data);
#在此程序段中加入此句
}
[root@localhost mysql]# cd /usr/local/src/ php-5.4.25
[root@localhost php-5.4.25]# ./configure \ #编译前配置
--prefix=/usr/local/php/ \ #指定安装位置
--with-config-file-path=/usr/local/php/etc/ \ #指定PHP配置文件位置
--with-apxs2=/usr/local/apache2/bin/apxs \ #调用apache2
--with-mysql=/usr/local/mysql/ \ #调用mysql
--with-libxml-dir=/usr/local/libxml2/ \ #调用libxml2库
--with-jpeg-dir=/usr/local/jpeg6/ \ #调用jpeg库
--with-png-dir=/usr/local/libpng/ \ #调用libpng库
--with-freetype-dir=/usr/local/freetype/ \ #调用freetype库
--with-gd=/usr/local/gd2/ \ #调用gd库
--with-mcrypt=/usr/local/libmcrypt/ \ #调用libmcrypt库
--with-mysqli=/usr/local/mysql/bin/mysql_config \#增加MysqlLi功能
--enable-soap \ #支持SOAP和Web Services
--enable-mbstring=all \ #支持多字节字符串
--enable-sockets #支持socket(套接字)通信
--with-pdo-mysql=/usr/local/mysql #启用mysql的pdo模块支持
[root@localhost php-5.4.25]# make
#编译
[root@localhost php-5.4.25]# make install
#编译安装
[root@localhost php-5.4.25]# cp /usr/local/src/ php-5.4.25/php.ini-production
/usr/local/php/etc/php.ini
[root@localhost php-5.4.25]# vi /usr/local/apache2/etc/httpd.conf
#修改apache配置文件,加入如下内容
AddType application/x-httpd-php.php.phps
#这句话的意思是:如果遇到.php和.phps扩展名,则调用PHP模块来解析这个文件的内容
[root@localhost php-5.4.25]# vi /usr/local/apache2/etc/httpd.conf
…省略部分输出…
# If the AddEncoding directives above are commented-out, then you probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php .phps #加载到此位置
…省略部分输出…
[root@localhost php-5.4.25]# /usr/local/apache2/bin/apachectl stop
[root@localhost php-5.4.25]# /usr/local/apache2/bin/apachectl start
[root@localhost php-5.4.25]# vi /usr/local/apache2/htdocs/index.php
<?php
phpinfo();
?>
图 1 phpinfo测试页
本文链接:http://task.lmcjl.com/news/12274.html