分类
Linux

CentOS安装php加速软件Zend Guard

说明:PHP5.3以上的版本不再支持Zend Optimizer,已经被全新的 Zend Guard Loader 取代,下面是安装Zend Guard具体步骤,以下操作均在终端命令行执行

1、下载Zend Guardcd /home

# wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz #32位 
# wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz #64位

2、安装Zend Guard

# mkdir /usr/zend #建立Zend Guard安装目录 
# tar xvfz ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz #解压安装文件 
# cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/zend/ #拷贝文件到安装目录 
# rm -rf /home/ZendGuardLoader-php-5.3-linux-glibc23-i386* #删除安装包
分类
Linux

CentOS安装php加速软件Zend Optimizer 3.3.9

引言:

php程序代码被加密过后,必须安装解密软件Zend Optimizer才能进行使用,比如Shopex等php程序,下面我们安装Zend Optimizer 3.3.9(针对php5.2,X之前的版本,php5.3.X需要安装Zend Guard),操作如下:

1、下载Zend optimizer

cd /home  
wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz #32位  
wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz #64位  
分类
Linux

在CentOS 6.2上安装Nginx+PHP5(PHP-FPM)+MySQL

1.使用非官方软件源

[root@localhost /]# rpm --import https://fedoraproject.org/static/0608B895.txt
[root@localhost /]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
[root@localhost /]# rpm –import http://rpms.famillecollet.com/RPM-GPG-KEY-remi  
[root@localhost /]# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
[root@localhost /]# yum install yum-priorities  

编辑/etc/yum.repos.d/epel.repo文件,启用这个源,使其优先级最高

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch 
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch  
failovermethod=priority  
enabled=1 p  
riority=10  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 
[...]  
分类
Linux

CentOS下nginx+php+fastcgi笔记

Centos版本5.7,首先需要做的进行内核优化。下面是内核优化参数

内核优化

net.ipv4.ip_forward = 0  
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0  
kernel.sysrq = 0 kernel.core_uses_pid = 1  
net.ipv4.tcp_syncookies = 1  
kernel.msgmnb = 65536  
kernel.msgmax = 65536  
kernel.shmmax = 68719476736  
kernel.shmall = 4294967296  
net.ipv4.tcp_max_tw_buckets = 6000  
net.ipv4.tcp_sack = 1  
net.ipv4.tcp_window_scaling = 1  
net.ipv4.tcp_rmem = 4096 87380 4194304  
net.ipv4.tcp_wmem = 4096 16384 4194304  
net.core.wmem_default = 8388608  
net.core.rmem_default = 8388608  
net.core.rmem_max = 16777216  
net.core.wmem_max = 16777216  
net.core.netdev_max_backlog = 262144  
net.core.somaxconn = 262144  
net.ipv4.tcp_max_orphans = 3276800  
net.ipv4.tcp_max_syn_backlog = 262144  
net.ipv4.tcp_timestamps = 0  
net.ipv4.tcp_synack_retries = 1  
net.ipv4.tcp_syn_retries = 1  
net.ipv4.tcp_tw_recycle = 1  
net.ipv4.tcp_tw_reuse = 1  
net.ipv4.tcp_mem = 94500000 915000000 927000000  
net.ipv4.tcp_fin_timeout = 1  
net.ipv4.tcp_keepalive_time = 30  
net.ipv4.ip_local_port_range = 1024 65000  
分类
Linux

Ubuntu 9.04 Nginx+php+mysql

由于Ubuntu 9.04已经包含了nginx,所以根本不要编译,安装超简单!

修改/etc/apt/sources.list文件内容为国内镜像,然后运行:

apt-get update apt-get install nginx  

即可完成安装。启动nginx:

/etc/init.d/nginx start

然后就可以访问http://localhost/了,一切正常!如果不能访问,先不要继续,看看是什么原因,解决之后再继续。

安装php和MySQL:

apt-get install php5-cli php5-cgi mysql-server-5.0 php5-mysql spawn-fcgi  

修改nginx的配置文件:/etc/nginx/sites-available/default
修改 server_name 为你的hostname;
修改index的一行修改为:
index index.php index.html index.htm;

去掉下面部分的注释:

location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name; include /etc/nginx/fastcgi_params; }  

重新启动nginx:

/etc/init.d/nginx stop /etc/init.d/nginx start

启动fastcgi php:

spawn-fcgi -a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi  

为了让php-cgi开机自启动:

cd /etc/init.d  
cp nginx php-cgi  
vim php-cgi  

替换nginx为php-cgi并修改相应部分为:

DAEMON=/usr/bin/spawn-fcgi  
DAEMON_OPTS="-a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi"

 … stop) 
echo -n "Stopping $DESC: " pkill -9 php-cgi echo "$NAME."  

然后运行rcconf设置php-cgi为开机自启动

在/var/www/nginx-default/目录下创建一个文件:

echo '' > /var/www/nginx-default/index.php  

最后用浏览器测试是否能够解析php脚本。一切OK。为了优化和缓存php,我们需要安装eAccelerator,安装必须还有开发工具,开发库已经PHP5-DEV。

apt-get install build-essential php5-dev  
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2  
tar xvf eaccelerator-0.9.6.1.tar.bz2  
cd eaccelerator-0.9.6.1  
phpize  
./configure –enable-eaccelerator=shared –with-php-config=/usr/bin/php-config 
make && make install  
mkdir /var/cache/eaccelerator  
chown www-data.www-data /var/cache/eaccelerator  

编辑/etc/php5/cgi/php.ini,在最后添加内容:

[eaccelerator] 
extension="eaccelerator.so"  
eaccelerator.shm_size="16"  
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="0"  
eaccelerator.shm_prune_period="0"  
eaccelerator.shm_only="0"  
eaccelerator.compress="1"  
eaccelerator.compress_level="9"  

最后重启nginx和php-cgi.