第一种rpm方法:
引用:
[root@localhost ~]# rpm -qa |grep freetype
freetype-2.1.9-1
[root@localhost ~]# rpm -qa |grep png
libpng-devel-1.2.7-1
libpng-1.2.7-1
libpng10-1.0.16-1
libpng10-devel-1.0.16-1
[root@localhost ~]# rpm -qa |grep jpeg
libjpeg-6b-33
libjpeg-devel-6b-33
[root@localhost ~]# rpm -qa |grep zlib
zlib-1.2.1.2-1
zlib-devel-1.2.1.2-1
[root@localhost ~]# rpm -qa |grep gd
gdbm-1.8.0-24
sysklogd-1.4.1-26_EL
gd-2.0.33-2
php-gd-4.3.9-3.1
rpm后文件会安装在/usr/include目录下,但是,我--with-gd=/usr/include没见成功,原因还有待以后研究
第二种源码安装(比较麻烦,但是安装清晰且成功了):
一、目的
安装Apahe与MySQL,将php安装成支持gif,png,jpeg,freetype,mysql,需要更强大的图形处理能力,可安装ImageMagic。可以分析大流量网站日志(更大流量的网站推荐用Webalizer,不过界面简陋:-,),同时安装mmcache+zend来加速度
二、安装环境描述
操作系统:GNU Linux kernel 2.4.20-8
本文重点在图形库安装
==************************************************************************************
web服务器:Apache httpd-2.0.50 下载:[url]http://apache.linuxforum.net/dist/httpd/httpd-2.0.50.tar.gz[/url]
数据库服务器:mysql-standard-4.0.20-pc-linux-i686.tar.gz 下载:[url]http://dev.mysql.com/get/Downloads/MySQL-4.0/mysql-standard-4.0.20-pc-linux-i686.tar.gz/from/http://mysql.ihostunit.com/[/url]
脚本程序语言:php-4.3.8.tar.gz下载:[url]http://cn2.php.net/get/php-4.3.8.tar.gz/from/cn.php.net/mirror[/url]
==************************************************************************************
其它库文件:
ZLIB:zlib-1.2.1.tar.gz 下载:[url]http://www.zlib.net/zlib-1.2.1.tar.gz[/url]
FreeType:freetype-2.1.9.tar.gz [url]http://sourceforge.net/projects/freetype/[/url]
下载:[url]http://umn.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.9.tar.gz[/url]
PNG:libpng-1.2.5.tar.gz [url]http://prdownloads.sourceforge.net/png-mng/libpng-1.2.5.tar.gz?download[/url]
JPEG:jpegsrc.v6b.tar.gz [url]http://freshmeat.net/projects/libjpeg/[/url] 下载:[url]http://freshmeat.net/redir/libjpeg/5665/url_tgz/jpegsrc.v6b.tar.gz[/url]
GD:gd-2.0.28.tar.gz 下载:[url]http://www.boutell.com/gd/http/gd-2.0.28.tar.gz[/url] 已支持gif
mmcache:[url]http://turck-mmcache.sourceforge.net/index_old.html[/url]下载:[url]http://sourceforge.net/project/showfiles.php?group_id=69426[/url]
zend: [url]www.zend.com[/url]
三、安装步骤
++************************************************************************************
1.安装mysql(由于安装mysql比较简单,省略)安装在/usr/local/mysql目录
2.安装apache
2.安装apache
./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-track-vars --enable-cgi --enable-so --enable-mods-shared=all --with-config-file-path=/usr/local/apache/conf
--prefix=/usr/local/apache 指定把apahce安装到/usr/local/apache目录中;
--enable-cgi 支持CGI;
--with-config-file-path=/usr/local/apache/conf 指定把apache的配制文件放在/usr/local/apache/conf中;比如httpd.conf配制文件就在这个目录中;
--enable-track-vars 为启动cookie的get/post等追踪功能
--enable-so DSO功能
--enable-mods-shared=all 包含所有的模块为DSO
如果需要更多的选项,可能通过下面的命令来查看;
./configure --help
make
make install
设置成开机自启动
在/etc/rc.d/rc.local文件中加入一行
/usr/local/apache/bin/apachectl start
这样每次重新启动系统以后,apache也会随系统一起启动.
++************************************************************************************
3.安装PHP
A先安装支持包(注意安装顺序)
建立初始目录:
mkdir /usr/local/modules
#jpeg目录
mkdir /usr/local/modules/jpeg6
mkdir /usr/local/modules/jpeg6/bin
mkdir /usr/local/modules/jpeg6/lib
mkdir /usr/local/modules/jpeg6/include
mkdir /usr/local/modules/jpeg6/man
mkdir /usr/local/modules/jpeg6/man/man1
A1、安装zlib
tar xzvf zlib-1.2.1.tar.gz
cd zlib-1.2.1
#不要用--prefix自定义安装目录,影响gd的安装
./configure
make
make install
A2、安装freetype
tar xzvf freetype-2.1.5.tar.gz
cd freetype-2.1.5
./configure --prefix=/usr/local/modules/freetype
make
make install
A3、安装libpng
tar xzvf libpng-1.2.5.tar.gz
#不要用--prefix自定义安装目录,影响gd的安装
cd libpng-1.2.5
cp scripts/makefile.std makefile
make test
make install
A3、安装jpeg
tar xzvf jpegsrc.v6b.tar.gz
./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static
make
make install
A4、安装GD
tar xzvf gd-2.0.28.tar.gz
./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-zlib --with-freetype=/usr/local/modules/freetype
make
make install
B、安装PHP
tar xzvf php-4.3.8.tar.gz
cd php-4.3.8
./configure --prefix=/usr/local/php --with-gd=/usr/local/modules/gd --with-jpeg-dir=/usr/local/modules/jpeg6 --with-zlib --with-png --with-freetype-dir=/usr/local/modules/freetype --enable-magic-quotes --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars --enable-force-cgi-redirect --enable-ftp --with-config-file-path=/usr/local/php/etc
一点说明:
--prefix=/usr/local/php 指定把php-4.3.8安装到/usr/local/php目录中;
--with-mysql=/usr/local/mysql 指定mysql数据服务器安装的位置;
--with-apxs2=/usr/local/apache/bin/apxs 这是加入apache中为DSO模块的位置;
-enable-track-vars 为启动cookie的get/post等追踪功能
--with-config-file-path=/usr/local/php/etc 指定php的配制文件存放的目录是/usr/local/php/etc目录,我们安装完成后,也要把php.ini复制到这个目录中来。
make
make install
cp php.ini-dist /usr/local/php/etc/php.ini
更改apache的配制文件:得加几行,目的是让apache能解释php程序。
查找AddType application/x-tar .tgz 行,在下面添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
找到下面一行在后面加上index.php,这表示网站的默认页也能够为index.php
DirectoryIndex index.html index.html.var index.php
进行php.ini文件的配置工作
查找safe_mode=Off,更改为safe_mode=On
1)查找max_execution_time = 30,更改为max_execution_time = 600
(2)查找max_input_time = 60,更改为max_input_time = 600
(3)查找memory_limit = 8M ,更改为memory_limit = 20M
(4)查找display_errors = On,更改为display_errors = Off
(5)查找register_globals = Off,更改为register_globals = On
(6)查找post_max_size = 8M,更改为post_max_size = 20M
(7)查找upload_max_filesize = 2M,更改为upload_max_filesize = 20M
(8)查找session.auto_start = 0,更改为session.auto_start = 1
执行:wq!命令保存后退出,从而完成了php.ini文件的配置工作。
C安装mmcache
Step 1. Compiling Turck MMCache
export PHP_PREFIX="/usr/local/php"
$PHP_PREFIX/bin/phpize
./configure --enable-mmcache=shared --with-php-config=$PHP_PREFIX/bin/php-config
make
提示:You must specify the real prefix where PHP is installed in the "export" command. It may be "/usr" "/usr/local", or something else.
Step 2. Installing Turck MMCache
make install
Step 3. Configuring Turck MMCache
Turck MMCache can be installed both as Zend or PHP extension, so you need to edit your php.ini file (usually /etc/php.ini).
To install as Zend extension:
zend_extension="/usr/lib/php4/mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
If you use thread safe build of PHP you must use "zend_extension_ts" instead of "zend_extension".
To install as PHP extension:
extension="mmcache.so"
mmcache.shm_size="16"
mmcache.cache_dir="/tmp/mmcache"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
Step 4. Creating cache directory
mkdir /tmp/mmcache
chmod 0777 /tmp/mmcache
4 安装Zend
解压后执行install.sh就可以了