Skip to main content

米斯特周

Tag: Php

How to Install XCache for PHP 5 on CentOS

XCache is a open-source opcode cacher, which means that it accelerates the performance of PHP on servers. It optimizes performance by removing the compilation time of PHP scripts by caching the compiled state of PHP scripts into the shm (RAM) and uses the compiled version straight from the RAM. This will increase the rate of page generation time by up to 5 times as it also optimizes many other aspects of php scripts and reduce server load.

Download xcahce:

cd /opt
wget tar -zxvf xcache-2.0.1.tar.gz
cd xcache-2.0.1

Use yum to install the PHP compile tools, if you can have installed before, skip this step

yum -y install php-devel yum install -y gcc make

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* #删除安装包

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位

在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
[...]

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

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/了,一切正常!如果不能访问,先不要继续,看看是什么原因,解决之后再继续。