PHP5.3安装

Php安装
FreeType安装
FreeType库是一个完全免费(开源)的、高质量的且可移植的字体引擎,它提供统一的接口来访问多种字体格式文件,包括TrueType, OpenType, Type1, CID, CFF, Windows FON/FNT, X11 PCF等。支持单色位图、反走样位图的渲染。FreeType库是高度模块化的程序库,虽然它是使用ANSI C开发,但是采用面向对象的思想,因此,FreeType的用户可以灵活地对它进行裁剪。

[root@yznvm1 yzn]# wget http://nchc.dl.sourceforge.net/project/freetype/freetype2/2.4.8/freetype-2.4.8.tar.gz
[root@yznvm1 yzn]# tar xzvf freetype-2.4.8.tar.gz              
[root@yznvm1 yzn]# cd freetype-2.4.8    
[root@yznvm1 yzn]# ./configure --prefix=/usr/local/freetype  
[root@yznvm1 freetype-2.4.8]# make && make install

[root@yznvm1 yzn]# wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
[root@yznvm1 yzn]# tar zxvf jpegsrc.v8c.tar.gz
[root@yznvm1 yzn]# cd jpeg-8c/
[root@yznvm1 jpeg-8c]# ./configure --prefix=/usr/local/jpeg
[root@yznvm1 jpeg-8c]# make &&  make install && cd ..

libpng
可查看http://www.libpng.org/pub/png/libpng.html

查看zlib版本
[root@yznvm1 yzn]# rpm -qa  zlib
zlib-1.2.3-3
zlib-1.2.3-3
出于性能和安全考虑,zlib最好是1.2.5以上版本

[root@yznvm1 yzn]# wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.7.tar.gz
[root@yznvm1 yzn]# tar zxvf libpng-1.5.7.tar.gz
[root@yznvm1 yzn]# cd libpng-1.5.7
[root@yznvm1 libpng-1.5.7]# ./configure --prefix=/usr/local/libpng
[root@yznvm1 libpng-1.5.7]# make && make install 
[root@yznvm1 libpng-1.5.7]# cd ..

libgd
http://www.libgd.org/  这个网站down
[root@yznvm1 gd-2.0.33]# http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
[root@yznvm1 gd-2.0.33]# tar xzvf gd-2.0.33.tar.gz
[root@yznvm1 gd-2.0.33]# cd gd-2.0.33
[root@yznvm1 gd-2.0.33]# ln -s /usr/local/libpng/include/pngconf.h /usr/include            
[root@yznvm1 gd-2.0.33]# ln -s /usr/local/libpng/include/png.h /usr/include 
[root@yznvm1 gd-2.0.33]# ./configure --prefix=/usr/local/gd2 --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg
[root@yznvm1 gd-2.0.33]# make
[root@yznvm1 gd-2.0.33]# make install

[root@yznvm1 yzn]# wget http://www.php.net/get/php-5.3.8.tar.gz/from/cn.php.net/mirror
[root@yznvm1 yzn]# tar xzvf php-5.3.8.tar.gz
[root@yznvm1 yzn]# cd php-5.3.8
[root@yznvm1 php-5.3.8]# ./configure --prefix=/usr/local/php --with-gd=/usr/local/gd2 --with-apxs2=/usr/local/apache/bin/apxs --enable-mbregex --enable-bcmath --with-mysql --with-zlib-dir --enable-mbstring=all --with-pdo-mysql --with-freetype-dir=/usr/local/freetype

configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!

[root@yznvm1 php-5.3.8]# find / -name mysql.h
/home/yzn/mysql-5.5.19/include/mysql.h
/usr/local/mysql/include/mysql.h
[root@yznvm1 php-5.3.8]# ./configure --prefix=/usr/local/php --with-gd=/usr/local/gd2 --with-apxs2=/usr/local/apache/bin/apxs --enable-mbregex --enable-bcmath --with-mysql=/usr/local/mysql --with-zlib-dir --enable-mbstring=all --with-pdo-mysql --with-freetype-dir=/usr/local/freetype

checking for mysql_config... not found
configure: error: Unable to find your mysql installation

[root@yznvm1 php-5.3.8]# ./configure --prefix=/usr/local/php --with-gd=/usr/local/gd2 --with-apxs2=/usr/local/apache/bin/apxs --enable-mbregex --enable-bcmath --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config  --with-zlib-dir --enable-mbstring=all --with-pdo-mysql --with-freetype-dir=/usr/local/freetype

checking for mysql_config... not found
configure: error: Unable to find your mysql installation

--with-mysqli=/usr/local/mysql/bin/mysql_config
[root@yznvm1 php-5.3.8]# ./configure --prefix=/usr/local/php --with-gd=/usr/local/gd2 --with-apxs2=/usr/local/apache/bin/apxs --enable-mbregex --enable-bcmath --with-mysql=/usr/local/mysql   --with-zlib-dir --enable-mbstring=all --with-pdo-mysql --with-freetype-dir=/usr/local/freetype

依然提示找不到mysql_config提示:

checking for mysql_config... /usr/bin/mysql_config is not a directory
configure: error: can not find mysql under the /usr/bin/mysql_config that you specified


[root@yznvm1 php-5.3.8]cp /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config
[root@yznvm1 php-5.3.8]# ./configure --prefix=/usr/local/php --with-gd=/usr/local/gd2 --with-apxs2=/usr/local/apache/bin/apxs --enable-mbregex --enable-bcmath --with-mysql=/usr/local/mysql   --with-zlib-dir --enable-mbstring=all --with-pdo-mysql --with-freetype-dir=/usr/local/freetype --with-png-dir=/usr/local/libpng/

[root@yznvm1 php-5.3.8]# make
[root@yznvm1 php-5.3.8]# make install
[root@yznvm1 php-5.3.8]# make test
[root@yznvm1 php-5.3.8]# cp php.ini-development /usr/local/php/lib/php.ini

验证:
[root@yznvm1 yzn]# ls /usr/local/apache/modules      
查看libphp5.so文件是否存在
[root@yznvm1 yzn]# vi /usr/local/apache/conf/httpd.conf
看以下行是否自动加入
LoadModule php5_module        modules/libphp5.so
[root@yznvm1 yzn]# touch /usr/local/apache/htdocs/test.php
[root@yznvm1 yzn]# vi /usr/local/apache/htdocs/test.php
[root@yznvm1 yzn]# ls /usr/local/apache/htdocs        
[root@yznvm1 php-5.3.8]# vi /usr/local/apache/conf/httpd.conf
AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
[root@yznvm1 yzn]# vi /usr/local/apache/conf/httpd.conf
修改这行
ServerName 127.0.0.1
如果不修改
[root@yznvm1 php-5.3.8]# /usr/local/apache/bin/apachectl -t  
[root@yznvm1 php-5.3.8]# /usr/local/apache/bin/apachectl start
会出错误
尽管如此仍然报错!
[root@yznvm1 php-5.3.8]# /usr/local/apache/bin/apachectl start
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
执行以下命令发现80端口被squid进程占用
[root@yznvm1 php-5.3.8]# netstat -na -p |grep 80            
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      7562/squid         
unix  2      [ ]         DGRAM                    11973  3880/automount     
unix  3      [ ]         STREAM     CONNECTED     11589  3806/acpid.socket  
unix  3      [ ]         STREAM     CONNECTED     11562  3806/acpid.socket  
[root@yznvm1 php-5.3.8]# vi /usr/local/apache/conf/httpd.conf
修改为Listen 10080
[root@yznvm1 php-5.3.8]# vi /usr/local/apache/conf/httpd.conf
[root@yznvm1 yzn]# netstat -na -p |grep 10080
tcp        0      0 :::10080                    :::*                        LISTEN      484/httpd
正常启动了


[root@yznvm1 yzn]# vi /usr/local/apache/htdocs/test.php
<?
phpinfo();
?>
[root@yznvm1 yzn]# vi /usr/local/apache/htdocs/test.php
浏览器
http://192.168.32.128:10080/test.php
显示的是空白页,原因是<??>是短标签的的模式,应该是没有打开短标签模式
[root@yznvm1 yzn]# vi /usr/local/php/lib/php.ini
short_open_tag = On
然后再次输入
http://192.168.32.128:10080/test.php

posted @ 2012-01-11 11:29  羽化成蝶  阅读(2840)  评论(0编辑  收藏  举报