php5.3.0 下载,源码安装PHP5.3.0

1. 安装zlib (安装libpng和gd前需要先安装zlib),下载地址:

# tar zxvf zlib-1.2.3.tar.gz

# cd  zlib-1.2.3

# ./configure

# make;make install

注:centos5.3自带此版本,可以不用安装yum list all|grep zlib查看

2. 安装libpng,下载地址:

# tar zxvf libpng-1.2.38.tar.gz

# cd libpng-1.2.38

# ./configure --prefix=/usr/local/libpng

# make test

# make install

3. 安装freetype,下载地址:

# tar zxvf freetype-2.3.9.tar.gz

# cd freetype-2.3.9

# ./configure --prefix=/usr/local/freetype

# make;make install

4. 安装jpeg7,下载地址:

# tar zxvf jpegsrc.v7.tar.gz

# cd jpeg-7

# ./configure --prefix=/usr/local/jpeg7

# make;make install

5. 安装fontconfig,下载地址:

# tar xzvf fontconfig-2.7.3.tar.gz

# cd fontconfig-2.7.3

# ./configure --with-freetype-config=/usr/local/freetype/bin/freetype-config --prefix=/usr/local/fontconfig

# make;make install

6. 安装gd,下载地址:

# tar zxvf gd-2.0.35.tar.gz

# cd gd-2.0.35

# ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg7/ --with-freetype=/usr/local/freetype/ --with-png=/usr/local/libpng/ --with-fontconfig=/usr/local/fontconfig/

//编译过程中会看到如下信息

** Configuration summary for gd 2.0.35:

Support for PNG library:          yes

Support for JPEG library:         yes

Support for Freetype 2.x library: yes

Support for Fontconfig library:   yes

Support for Xpm library:          no

Support for pthreads:             yes

//可以看到png 、 jpeg 、 freetype都已经安装上了

# make

# make install

7. 正式安装php,下载地址:

# tar xzvf php-5.2.11.tar.gz

# cd php-5.2.11

# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib --with-png-dir=/usr/local/libpng/ --with-jpeg-dir=/usr/local/jpeg7/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd/ --enable-mbstring --with-mcrypt=/usr/include/

####################################################################################参数说明:

--enable-mbstring       Enable multibyte string support

--with-mcrypt[=DIR]     Include mcrypt support

--enable-mbstring##############################################################################################

出现错误:configure: error: Cannot find libmysqlclient under /usr.

Note that the MySQL client library is not bundled anymore!

通过查找libmysqlclient,发现是在/usr/lib64/mysql/目录内的libmysqlclient.so.15.0.0做的软连接,PHP默认是去的 /usr/lib/搜索,所以没有找到.找到问题了就好解决了.输入代码:

cp -rp /usr/lib64/mysql/libmysqlclient.so.15.0.0 /usr/lib/libmysqlclient.so

接着make一切正常,在make install后出现错误

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/ChannelFile.php on line

这样之后可以解决

mv /usr/local//php5/lib/php/.channels /usr/local/php5/lib/php/.channels-old

/usr/local/php/bin/pecl update-channels

继续make install,出现如下信息

Wrote PEAR system config file at: /usr/local/php5/etc/pear.conf

You may want to add: /usr/local/php5/lib/php to your php.ini include_path

Installing PDO headers:          /usr/local/php5/include/php/ext/pdo/

8.整合php,mysql和apache

cp php.ini-recommended /usr/local/php5/lib/php.ini(php.ini默认位置可以在phpinfo里面查看到)

##############################################################################################

php.ini-dist  用于开发环境,php.ini-recommand   用于生产环境

##############################################################################################

vi /usr/local/php5/lib/php/php.ini将extension=php_mysql.dll前面的;去掉

vi /etc/httpd.conf

添加以下两行

AddType application/x-httpd-php .php .phtml

AddType application/x-httpd-php-source .phps

然后加入php5的模块

LoadModule php5_module        modules/libphp5.so

9. 安装ZendOptimizer,下载地址:

# tar xzvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz

# cd ZendOptimizer-3.3.3-linux-glibc23-i386

# ./install.sh

这个是老版本ZendOptimizer的安装方法,3.3.9新版本只要在php.ini里面加入一行:

zend_extension/usr/local/src/php/ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so 就行了,OK,搞定!

注:

在编译gd的时候png报错:

gd_png.c:791: syntax error before "for"

gd_png.c:793: warning: parameter names (without types) in function declaration

gd_png.c:793: warning: data definition has no type or storage class

gd_png.c:794: syntax error before '}' token

gd_png.c:798: warning: parameter names (without types) in function declaration

gd_png.c:798: warning: data definition has no type or storage class

gd_png.c:799: syntax error before '}' token

gd_png.c:802: syntax error before '&' token

gd_png.c:802: warning: data definition has no type or storage class

gd_png.c:404: storage size of `open' isn't known

[color=Red]make[2]: *** [gd_png.lo] Error 1

make[2]: Leaving directory `/tmp/gd-2.0.26gif'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/tmp/gd-2.0.26gif'

make: *** [all] Error 2

解決方法为:

vi gd_png.c

找到「png.h」改成「/usr/local/libpng2/include/png.h」)

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值