Chinaunix首页 | 论坛 | 博客
  • 博客访问: 199266
  • 博文数量: 25
  • 博客积分: 2030
  • 博客等级: 大尉
  • 技术积分: 335
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-05 02:49
文章分类

全部博文(25)

文章存档

2012年(1)

2011年(1)

2010年(2)

2009年(21)

我的朋友

分类:

2009-08-10 02:41:33

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」)

阅读(3982) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~