首页站长新闻Debian下手动安装LiteSpeed+PHP+MySQL教程

Debian下手动安装LiteSpeed+PHP+MySQL教程

2012-08-27 47

      Debian系统一直是笔者和喜欢的Linux分枝,最小化的系统占用系统资源非常的少,而且操作起来也很简单。之前陆陆续续的折腾了一下LiteSpeed,最近就把一些手动安装的心得贴出来和大家分享吧,如果实在懒得动脑,可以参考之前的文章,使用llsmp一键安装包。下面开始安装!

      1.清理Debian,去除不必要的软件包

      2.安装MySQL及相关的库文件

      3.安装LiteSpeed

      4.编译PHP

      5.配置eAccelerator

      6.安装Zend Loader

      1.清理Debian,去除不必要的软件包

apt-get update

apt-get -y purge apache2-* bind9-* xinetd samba-* nscd-* portmap sendmail-* sasl2-bin

apt-get -y purge lynx memtester unixodbc python-* odbcinst-* sudo tcpdump ttf-*

apt-get autoremove && apt-get clean

      2.安装MySQL及相关的库文件

apt-get remove apache

apt-get update

apt-get install autoconf gcc g++ libjpeg62-dev libpng12-dev libxml2-dev curl libcurl4-openssl-dev libmcrypt-dev libmhash-dev libfreetype6-dev patch make mcrypt mysql-server libmysql++-dev zlib-bin zlib1g-dev

apt-get update && apt-get upgrade

export PHP_AUTOCONF=/usr/bin/autoconf

export PHP_AUTOHEADER=/usr/bin/autoheader

      安装时中途会询问MySQL的密码,连续输入两次即可

      3.安装LiteSpeed

      访问LiteSpeed官网获得最新版本的下载链接:http://litespeedtech.com/litespeed-web-server-downloads.html

cd /tmp

wget http://litespeedtech.com/packages/4.0/lsws-4.1.13-std-i386-linux.tar.gz

tar zxvf lsws*

cd lsws*

cd ./install.sh

      出现许可协议,只需持续按下【空格】键到最后,输入Yes(注意Y大写)

      交互回答如下问题

Destination [/usr/local/lsws]: 回车
User name [admin]:管理员账号(默认admin)
Password:管理员密码
Retype password:密码确认
Email addresses [root@localhost]:你的邮箱
User [nobody]:默认,直接回车
Group [nogroup]:默认,直接回车
HTTP port [8088]:写80
Admin HTTP port [7080]:Litespeed面板端口,可默认,直接Enter
Setup up PHP [Y/n]:默认,直接回车
Suffix for PHP script(comma separated list) [php]:默认,直接回车
Would you like to install AWStats Add-on module [y/N]?默认,直接回车
Would you like to have LiteSpeed Web Server started automatically when the server restarts [Y/n]?默认,直接回车
Would you like to start it right now [Y/n]?默认,直接回车

      此时不要关闭SSH窗口,后面还要用到~

      4.编译PHP

      访问litespeed管理后台:http://ip:7080

      点击Actions->Compile PHP

      选择PHP版本,点击Next(我选择的是5.3.15)

      在编译参数中填写为如下段,

‘–with-pdo-mysql’ ‘–with-mysql’ ‘–with-mysqli’ ‘–with-zlib’ ‘–with-gd’ ‘–enable-shmop’ ‘–enable-track-vars’ ‘–enable-sockets’ ‘–enable-sysvsem’ ‘–enable-sysvshm’ ‘–enable-magic-quotes’ ‘–enable-mbstring’ ‘–with-iconv’ ‘–with-litespeed’ ‘–enable-inline-optimization’ ‘–with-curl’ ‘–with-curlwrappers’ ‘–with-mcrypt’ ‘–with-mhash’ ‘–with-mime-magic’ ‘–with-openssl’ ‘–with-freetype-dir=/usr/lib’ ‘–with-jpeg-dir=/usr/lib’

      小内存VPS在编译的时候,会出现内存不够的问题”virtual memory exhausted: Cannot allocate memory”,此时在参数栏处再加个”–disable-fileinfo”,重新编译一下应该就OK了~

      下面可选安装组件,我只选择了eAccelerator;

      点击Build PHP 5.x.x

      LiteSpeed开始下载包,下载完成后,点击Next

      此时不要刷新页面!

      在SSH运行如下命令:

/usr/local/lsws/phpbuild/buildphp_manual_run.sh

      直到浏览器提示“*Complete*”就算是大功告成了~

      5.配置eAccelerator

      PHP虽然安装好了,但之前我们选择的eAccelerator还需要配置一下

      创建eAccelerator的缓存目录

mkdir /usr/local/eaccelerator_cache

chmod -R 777 /usr/local/eaccelerator_cache

      编辑php.ini

cp /usr/local/lsws/php/php.ini /usr/local/lsws/lsphp5/lib/

vi /usr/local/lsws/lsphp5/lib/php.ini

      在php.ini后面加入如下字段

[eaccelerator]
zend_extension=”/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so”
eaccelerator.shm_size=”1″
eaccelerator.cache_dir=”/usr/local/eaccelerator_cache”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”3600″
eaccelerator.shm_prune_period=”3600″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″
eaccelerator.keys = “disk_only”
eaccelerator.sessions = “disk_only”
eaccelerator.content = “disk_only”

      这时,可以打开http://ip/phpinfo.php看看eAccelerator安装的如何~

      6.安装Zend Loader

wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz

tar zxvf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz

mkdir -p /usr/local/zend/

cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/local/zend/

      编辑php.ini

vi /usr/local/lsws/lsphp5/lib/php.ini

      添加如下字段

[Zend.loader]

zend_loader.enable=1

zend_loader.disable_licensing=1

zend_loader.obfuscation_level_support=3

zend_loader.license_path=

zend_extension=”/usr/local/zend/ZendGuardLoader.so“

      查看是否安装成功

/usr/local/lsws/lsphp5/bin/php -v

      最后重启litespeed生效~

/etc/init.d/lsws restart

      环境基本配置好了,但是要使用还需要添加虚拟主机等一系列的步骤和过程,微魔会在日后的教程中和大家分享。

来源:魔都部落

  • 广告合作

  • QQ群号:707632017

温馨提示:
1、本网站发布的内容(图片、视频和文字)以原创、转载和分享网络内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。邮箱:2942802716#qq.com(#改为@)。 2、本站原创内容未经允许不得转裁,转载请注明出处“站长百科”和原文地址。

相关文章