红联Linux门户
Linux帮助

安装配置Apache+PHP+MySQL+Zend Optimizer

发布时间:2006-08-21 12:32:07来源:红联作者:紫琼
1) 下载软件

[code]# cd /usr/local/src
# wget http://download.discuz.net/env/httpd-2.0.58.tar.bz2
# wget http://download.discuz.net/env/mysql-standard-5.0.22-linux-i686.tar.gz
# wget http://download.discuz.net/env/php-5.1.4.tar.bz2
# wget http://download.discuz.net/env/ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz[/code]

2) 安装MySQL

[code]# tar xzvf mysql-standard-5.0.22-linux-i686.tar.gz
# useradd mysql
# mv mysql-standard-5.0.22-linux-i686 /usr/local/mysql
# cd /usr/local/mysql
# scripts/mysql_install_db --user=mysql
# chown -R root .
# chown -R mysql data
# chgrp -R mysql .
# mv data /var/lib/mysql
# ln -s /var/lib/mysql ./data
# cp support-files/my-large.cnf /etc/my.cnf
# bin/mysqld_safe --user=mysql &
# bin/mysqladmin -u root password newpassword_for_root
# bin/mysqladmin -u root -p shutdown
# cp support-files/mysql.server /etc/init.d/mysqld
# chkconfig --add mysqld
# /etc/rc.d/init.d/mysqld start[/code]

3) 编译安装Apache

[code]# cd /usr/local/src
# tar xjvf httpd-2.0.58.tar.bz2
# cd httpd-2.0.58
# ./configure --prefix=/usr/local/apache2 --mandir=/usr/ share/man --enable-module=so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-gzip --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache
# make
# make install[/code]

4) 编译安装PHP

[code]# cd /usr/local/src
# tar xjvf php-5.1.4.tar.bz2
# cd php-5.1.4
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/ apache2/bin/apxs --with-zlib --with-bz2 --with-tiff-dir --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/ gd2 --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf --enable-mbstring --with-mysql=/usr/local/mysql --with-config-file-path=/etc --disable-ipv6 --enable-gd- native-ttf
# make
# make install
# cp php.ini-dist /etc/php.ini[/code]

5) 安装Zend Optimizer

[code]# cd /usr/local/src
# tar xzvf ZendOptimizer-3.0.1-linux-glibc21-i386.tar.gz
# ./ZendOptimizer-3.0.1-linux-glibc21-i386/install.sh[/code]

6) 整合Apache与PHP

[code]# vi /usr/local/apache2/conf/httpd.conf[/code]
搜索:

[code]DirectoryIndex index.html index.html.var[/code]
将其改为:

[code]DirectoryIndex index.html index.htm index.php[/code]
搜索:

[code]AddType application/x-gzip .gz .tgz[/code]
在下面添加一行:

[code]AddType application/x-httpd-php .php[/code]
保存退出后重启Apache

[code]# /usr/local/apache2/bin/apachectl restart[/code]
文章评论

共有 0 条评论