Debian 6(Squeeze)编译搭建shopex或ecshop环境,真是没办法,老实说不
Debian 6(Squeeze)编译搭建shopex或ecshop环境,真是没办法,老实说不
Debian 6(Squeeze)编译搭建shopex或ecshop环境:Nginx+php5.2.x+mysql+ZendOptimizer
shopex 环境目前只支持 php5.2.x ,是因为它只支持 Zend Optimizer,高版本的 Zend Guard 是不支持的, 而 Debian 6 默认安装PHP是5.3.x,这个版本的php是不支持Zend Optimizer,只支持Zend Guard.所以很矛盾呀,要想使用shopex系统,要么使用debian5 ,但又纠结于想用更高版本的debian6 ,所以我们这里讲述如何在debian6 系统上手动编译安装支持shopex环境的搭建。真是没办法,老实说不愿破坏debian自带的软件包管理系统。
一、安装nginx
添加nginx源
vi /etc/apt/sources.list deb http://nginx.org/packages/debian/ squeeze nginx deb-src http://nginx.org/packages/debian/ squeeze nginx apt-get update apt-get install nginx
这样我们就能升级到最新稳定版本的nginx,截至目前是1.0.10
二、安装mysql-server及编译所需库文件
apt-get install mysql-server libmysqlclient15-dev
三、编译安装php5.2.x
准备php编译所需的依赖包
aptitude install libgd2-noxpm-dev libxml2-dev libcurl3-dev libmhash-dev libmcrypt-dev libxslt-dev libpspell-dev libbz2-dev libglobus-openssl-dev
安装编译环境
apt-get install build-essential
下载php5.2.17
wget http://am.php.net/distributions/php-5.2.17.tar.gz
下载php-fpm补丁
wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz gzip -d php-5.2.17-fpm-0.5.14.diff.gz tar zvxf php-5.2.17.tar.gz cd php-5.2.17 patch -p1 < ../php-5.2.17-fpm-0.5.14.diff ./configure –prefix=/usr/local/php5 –with-iconv –with-zlib –enable-xml –enable-fastcgi –enable-fpm –with-curl –enable-force-cgi-redirect –enable-mbstring –with-mcrypt –with-gd –enable-gd-native-ttf –with-mhash –enable-sockets –with-xmlrpc –enable-zip –with-mysql –with-mysqli –enable-ftp –with-jpeg-dir –with-freetype-dir –with-png-dir –enable-bcmath –enable-calendar –enable-exif –with-openssl –with-bz2 make make install cp php.ini-dist /usr/local/php5/lib/php.ini vi /usr/local/php5/etc/php-fpm.conf
去掉前面的注释
<value name=”user”>nobody</value> <value name=”group”>nogroup</value> ln -s /usr/local/php5/sbin/php-fpm /etc/init.d/php-fpm /etc/init.d/php-fpm start
修改默认主机的配置:
vi /etc/nginx/conf.d/default.conf location ~ .php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name; include fastcgi_params; }
注意:/usr/share/nginx/html$fastcgi_script_name; 前面的目录是默认主目录的位置,请根据你自己的实际情况修改,默认从nginx.org源安装的nginx最新版本,默认主目录是/usr/share/nginx/html
/etc/init.d/nginx restart
好了,写个info文件,测试一下nginx+php+mysql是否完美结合了:)
四、安装ZendOptimizer
下载ZendOptimizer-3.3.9-Linux-glibc23-i386.tar.gz,这是ZendOptimizer的最后一个版本了,也是shopex和ecshop能支持的ZendOptimizer,更高的版本是ZendGuardLoader,
但目前shopex等都不支持呀,非常让人纠结,要不今天我们也不会写这篇文章指导大家搭建合适的环境。
make /usr/local/zend
把解压后的so文件,拷贝到刚才建立的目录
vi /usr/local/php5/lib/php.ini
增加:
zend_extension= /usr/local/zend/ZendOptimizer.so
重启一下 php-fpm 应该马上生效了
自此,shopex或者ecshop的安装环境已经搭建成功。
后续:
五、加入memcache支持
aptitude install memcached apt-get install m4 autoconf wget http://pecl.php.net/get/memcache-2.2.6.tgz tar zvxf memcache-2.2.6.tgz cd memcache-2.2.6 /usr/local/php5/bin/phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 ./configure –enable-memcache –with-php-config=/usr/local/php5/bin/php-config –with-zlib-dir make make install Installing shared extensions: /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/
修改php.ini
vi /usr/local/php5/lib/php.ini
增加下面4句
extension_dir = “/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/” extension = memcache.so memcache.chunk_size = 32768 memcache.hash_strategy = consistent
一般教程都是只加上面2句,建议把下面2句也加上,修改一下默认的一些参数,使memcache的使用性能更加有效率
六、加入eAccelerator支持
wget http://cdnetworks-kr-1.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip unzip eaccelerator-0.9.6.1.zip cd eaccelerator-0.9.6.1 /usr/local/php5/bin/phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 ./configure –enable-eaccelerator=shared –with-php-config=/usr/local/php5/bin/php-config make make install
修改php.ini
vi /usr/local/php5/lib/php.ini extension=”eaccelerator.so” eaccelerator.shm_size=”32″ eaccelerator.cache_dir=”/var/cache/eaccelerator” 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.session = “disk_only” eaccelerator.content = “disk_only”
保存
make /var/cache/eaccelerator chmod -R 777 /var/cache/eaccelerator
因为之前安装memcache,已经加了extension_dir = “/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/”,所以安装eaccelerator就不加这句了,如果实际操作
中没装memcache,那就需要在php.ini中加入这句,或者直接指定eaccelerator.so的绝对路径
重启一下 php-fpm 应该马上生效了。
评论暂时关闭