您的位置:首页 > 编程语言 > PHP开发

LAMP+eAccelerator+Zend的安装视频教程(处女作)

2013-04-17 22:07 411 查看
一、安装前的准备工作

1、操作系统的准备
2、相关软件的准备
3、系统环境的准备
bzip2-devel
zlib-devel
libjpeg-devel
libpng-devel
libtiff-devel
freetype-devel
openssl-devel
libxml2-devel
gettext-devel
这里我们将编译GD所必须的一些小软件比如libpng,libtiff,freetype,libjpeg,gettext-devel等先用RPM 的方式一并安装好,避免手动编译浪费时间,同时也能避免很多错误,这几个小软件的编译很麻烦。这几个小软件编译错误了,GD 当然安装不了,php5 的编译当然也没戏了。所以我们抓大放小,对这些小牛鬼蛇神采取快速简洁的方式进行安装。并且对服务器的性能也不能产生什么影响。
4、系统目录的准备

二安装gd、apache、mysql、php基本环境
1、安装GD2
cd /soft/
tar xzvf gd-2.0.35.tar.gz // 解压软件包
cd gd-2.0.35
./configure –prefix=/web/gd // 配置
make // 是用来编译的,它从 Makefile 中读取指令,然后编译。
make install //是用来安装的,它也从 Makefile 中读取指令,安装到指定的位置。

其实安装源码软件要这三步走: ./configure make make install

2、安装apache2
tar zxvf httpd-2.2.6.tar.gz
cd httpd-2.2.6
./configure –prefix=/web/apache –with-ssl –enable-ssl –enable-so –enable-rewrite –disable-cgid –disable-cgi
make
make install
下面教大家如何把apache设置成系统服务

将apache 设置成开机自启动:的两种方法

在/etc/rc.d/rc.local 文件中加入一行
/usr/local/apache2/bin/apachectl start
这样每次重新启动系统以后,apache 也会随系统一起启动.

或者将apache 安装为系统服务

cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd然后
vi /etc/rc.d/init.d/httpd
添加(在#!/bin/sh 下面)
chkconfig: 2345 10 90
description: Activates/Deactivates Apache Web Server
最后,运行chkconfig 把Apache 添加到系统的启动服务组里面:
chkconfig –add httpd
chkconfig httpd on

3、安装mysql5
tar xzvf mysql-5.0.46.tar.gz
cd mysql-5.0.46
./configure –prefix=/web/mysql –with-comment=Source –with-server-suffix=-enterprise-gpl –with-mysqld-user=mysql –without-debug –with-socket-path=/myweb/mysql/var/mysql.sock –with-big-tables –with-charset=utf8 –with-collation=utf8_general_ci –with-extra-charsets=all –with-pthread –enable-static –enable-thread-safe-client –with-client-ldflags=-all-static –with-mysqld-ldflags=-all-static –enable-assembler –without-innodb –without-ndb-debug –without-isam –enable-local-infile –with-readline –with-raid
groupadd mysql
useradd -g mysql mysql
make
make install
cd /web/mysql
chown -R mysql .
chgrp -R mysql .
bin/mysql_install_db –user=mysql
chown -R root .
chown -R mysql var
cp share/mysql/my-medium.cnf /etc/my.cnf
cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig –add mysqldchkconfig –level 3 mysqld on
/etc/rc.d/init.d/mysqld start
bin/mysqladmin -u root password 123456

4、安装php5
cd php-5.2.5
tar zxvf php-5.2.5.tar.gz
./configure –prefix=/web/php –with-apxs2=/web/apache/bin/apxs –with-zlib-dir –with-bz2 –with-libxml-dir –with-gd=/web/gd –enable-gd-native-ttf –enable-gd-jis-conv –with-freetype-dir –with-jpeg-dir –with-png-dir –with-ttf –enable-mbstring –with-mysql=/web/mysql –with-config-file-path=/etc –with-iconv –disable-ipv6 –enable-static –enable-zend-multibyte –enable-inline-optimization –enable-zend-multibyte –enable-sockets –enable-soap –with-openssl –with-gettext –enable-ftp
make
make install
cp php.ini-recommended /etc/php.ini

5、整合apache 与php
vi /usr/local/apache2/conf/httpd.conf
找到
DocumentRoot “/web/www”
把它变成自己的服务目录
找到
AddType application/x-gzip .gz .tgz
在其下添加如下内容:
AddType application/x-httpd-php .php
查找:(设置 WEB 默认文件)
DirectoryIndex index.html
修改为:
DirectoryIndex index.php index.html index.htm
找到这一段:
AllowOverride controls what directives may be placed in .htaccess files.
It can be “All”, “None”, or any combination of the keywords:Options FileInfo AuthConfigLimit
#AllowOverride none
更改为
AllowOverride all
允许apache rewrite
保存httpd.conf,退出。

重新启动apache
在apache的服务目录中新建一个文件用来测试php的情况
文件名为test.php
内容为
< ? php
phpinfo();
?>
到此:我们的PHP环境已经安装成功!

下面我们来安装Zend
6、安装Zend
和前面的安装步骤差不多的,只是安装时出现安装介面:
具体方法看演示

7、安装eaccelerator
eaccelerator 是php 的加速软件,使用后php 的执行效率会有较大幅度的提升。目前eaccelerator0.9.5.2已经和ZendOptimizer-3.3.0 能够基本上兼容啦。不过我个人觉得,ZendOptimizer-3.3.0没有加速的功能,反而使php 运行变慢,只是起到了运行zend 加密文件的作用而已。闲话不多说了,大家有兴趣的,可以去google 下。
tar -jxvf eaccelerator-0.9.5.2.tar.bz2
cd eaccelerator-0.9.5.2
export PHP_PREFIX=”/usr/local/php” //指定一下php 的安装目录
$PHP_PREFIX/bin/phpize
./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config
make
make install
编译安装后我们会看到屏幕提示的eaccelerator.so 所在的目录,php5.2.X 系列是在
/usr/local/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so,记住这个路径,待会要用到。
修改php.ini(安装完zend 之后,php.ini 存放于/usr/local/Zend/etc)
第一种方法:安装为 PHP 扩展:在文件最后,[zend] 之前,注意,这部分内容务必放在[zend] 之前,不然
可能会出现不可预期的服务器问题。
添加下列信息:
[eaccelerator]extension=”/web/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so ”
eaccelerator.shm_size=”32″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″eaccelerator.shm_only=”0″eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

第二种方法:安装为 zend扩展:
在文件最后,[zend]的下一行加入如下的代码
zend_extension=”/web/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″
然后
mkdir /tmp/eaccelerator // 建立目录
chmod 0777 /tmp/eaccelerator // 修改目录属性
重启apache,phpinfo 显示:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c)1998-2006 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, byeAccelerator with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies with Zend Optimizer v3.3.0, Copyright (c) 1998-2006, by Zend Technologies
也会有eAccelerator 的具体信息。
到现在为止,全部的环境已经成功搭建好了!
接下来就可以开始你的网站之旅了
这次视频教程到些结束!不对不妥之处,请大家多多指教!~

★★★★★★★★★★★★★★★★★★视频观看地址★★★★★★★★★★★★★★★★★ http://www.boobooke.com/v/bbk1240
 http://www.boobooke.com/v/bbk1241

 http://www.boobooke.com/v/bbk1242
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息