当前位置:首页> PHP教程> php基础
关键字
文章内容
redhat9+apache+mysql+php+zend安装(成功版)
 
 
修改时间:[2008/06/13 12:07]    阅读次数:[858]    发表者:[起缘]
 
Zend Optimizer是由PHP核心引擎“Zend”创建者Zend技术公司所开的免费PHP优化软件。据Zend公司透露使用这个软件某些情况下至少可以提高性能30%以上!这么好的免费大餐当然要用,

-----------------------------------------------
系统:red hat linux 9.0

step1:

apache:httpd-2.0.58.
[各种版本请去http://apache.justdn.org/httpd下载]
http://apache.justdn.org/httpd/httpd-2.0.58.tar.gz

PHP 4.4.1
[可在官方下载5.1.1和4.4.2两个版本http://www.php.net/downloads.php]
http://cn.php.net/get/php-4.4.1.tar.gz/from/cn2.php.net/mirror

MySQL Database Server 5.0.22
[各种版本可在mysql官方下载到 http://downloads.mysql.com/archives.php]
http://downloads.zend.org http://downloads.mysql.com
(ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz我开始使用这个没有成功!后来换了前面的2.6.0就成功了)
全部wget完毕

step2:

安装环境如果不确定的朋友,用rpm查一下
如果原来编译安装的,删了即可,放那也没事

rpm qa | grep apache
rpm qa | grep mysql
rpm qa | grep php
再顺便查查

rpm -qa | grep zlib
rpm -qa | grep libpng
rpm -qa | grep freetype
rpm -qa | grep jpeg
rpm -qa | grep gd
出来的结果必须有以下rpm包成功安装的前提!如果没有就到 http://rpmfind.net/linux/RPM/index.html http://rpmfind.net/linux/RPM/index.html 搜索吧!


[root@localhost local]# rpm -qa | grep zlib
zlib-1.1.4-8
zlib-devel-1.1.4-8
[root@localhost local]# rpm -qa | grep libpng
libpng-1.2.2-16
libpng-devel-1.2.2-20
libpng10-1.0.13-8
libpng10-devel-1.0.13-8
[root@localhost local]# rpm -qa | grep freetype
freetype-devel-2.1.3-6
freetype-2.1.3-6
[root@localhost local]# rpm -qa | grep jpeg
libjpeg-6b-26
libjpeg-devel-6b-26
[root@localhost local]# rpm -qa | grep gd
gdk-pixbuf-0.18.0-7
gdb-5.3post-0.20021129.18
gdbm-1.8.0-20
sysklogd-1.4.1-12
gdk-pixbuf-gnome-0.18.0-7
gdbm-devel-1.8.0-20
gd-1.8.4-11
因为我要装PHPWind,所以需要gd支持水印


安装顺序:mysql > apache > php > zend


step3:具体安装
1,mysql


cd /usr/local
groupadd mysql
useradd -g mysql mysql
cd /usr/local
tar zxvf mysql-standard-5.0.22-linux-i686.tar.gz
ln -s mysql-VERSION-OS mysql
cd mysql
scripts/mysql_install_db
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/data
chgrp -R mysql /usr/local/mysql
chown -R root /usr/local/mysql/bin
bin/safe_mysqld --user=mysql &
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
copy一个执行脚本
chkconfig --add mysqld
/etc/rc.d/init.d/mysqld start
此时,若你安装成功的话,会有如下提示:Starting MySQL SUCCESS!

2,apache
cd ..
返回/usr/local目录

tar zxvf httpd-2.0.58.tar.gz
cd httpd-2.0.58
./configure --prefix=/usr/local/apache --enable-so
编译apache,加上加载模块参数

make
make install
/usr/local/apache/bin/apachectl start
显示httpd (pid xxxxx) already running
ps -ef | grep httpd
看看是否有httpd进程

vi /usr/local/apache/conf/httpd.conf
配置一下conf脚本
在http.conf最末端找到

#
# ServerAdmin [email protected]
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
复制,添加在最后去掉#修改为

ServerAdmin [email protected]
DocumentRoot /var/www
ServerName 192.168.1.1
ServerAlias 192.168.1.1

3,php

cd ..
tar xzvf php-4.4.1.tar.gz
cd php-4.4.1
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql --with-config-file-path=/usr/local/php/etc --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-xml --enable-mbstring
make
make install
cp php.ini-recommended /usr/local/php/lib/php.ini //(这种也是可以的,我使用的就是这种)
#cp php.ini-dist /usr/local/php/lib/php.ini //(有的用户使用这种)

修改php.ini文件,全局注册变量改为开启

vi /usr/local/php/lib/php.ini
register_globals = On
vi /usr/local/apache/conf/httpd.conf
//编辑文件,加入php文件头支持
找到

DirectoryIndex index.html index.html.var
改为

DirectoryIndex index.php index.html index.html.var
找到

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
改为

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php

4,zend
cd ..
tar xzvf ZendOptimizer-2.6.0-linux-glibc21-i386.tar.gz
cd ZendOptimizer-2.6.0-linux-glibc21-i386
# ./install.sh
mud安装过程中会要你输入php.ini的路径:/usr/local/php/lib/php.ini
我们已经在安装php的时候将php.ini-recommended脚本复制过去了
只需确定/usr/local/php/lib即可

最后

/usr/local/apache/bin/apachectl restart
在/home/wwwroot目录下保存为/index.php测试下:

echo 'installing linux+apache+mysql+php+zend success';
?>
phpinfo();
?>;
打开浏览器,输入http://192.168.1.1
installing linux+apache+mysql+php+zend success
以及phpinfo()的内容!

This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies with Zend Extension Manager v1.0.9, Copyright (c) 2003-2005, by Zend Technologies with Zend Optimizer v2.6.0, Copyright (c) 1998-2005, by Zend Technologies

Zend Optimizer
Optimization Pass 1 enabled
Optimization Pass 2 enabled
Optimization Pass 3 enabled
Optimization Pass 4 enabled
Optimization Pass 9 disabled
Zend Loader enabled
License Path no value