. /etc/profile 或 source /etc/profile
配置php-fpm
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
启动php-fpm
sudo /usr/local/php/sbin/php-fpm
二、编译安装NGINX
1.下载NGINX源码,我这里下载的版本是nginx-1.1.8(nginx-1.1.8.tar.gz)
http://nginx.org/
2.安装依赖包
yum -y install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel open openssl-devel
3.解压源码包
tar xf nginx-1.1.8.tar.gz
cd nginx-1.1.8
4.生成makefile与构建
./configure --prefix=/usr/local/nginx
注释:
--prefix=/usr/local/nginx 主程序安装目录
还有很多其他编译选项,请查阅其他相关资料
make
make install
5.修改配置文件
cd /usr/local/nginx/conf
对nginx的主配置文件nginx.conf进行修改
location / {
root web根目录;
index index.html index.htm index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME web根目录$fastcgi_script_name;
include fastcgi_params;
}
6.启动nginx
./usr/local/nginx/sbin/nginx
7.通过ps命令观察nginx是否启动成功
ps -elf | grep nginx
nginx启动的过程中还遇见了一个端口占用的问题,启动时报如下错
Starting nginx daemon: nginx[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: still could not bind()
nginx already running.
原因是对80端口重复绑定,在配置中把ipv6的80端口绑定注释掉以后就好了(http://bbs.archlinuxcn.org/viewtopic.php?id=420)
三、编译安装YAF
1.下载yaf源码,这里下载的是2.3.3版本(yaf-2.3.3.tgz)
http://pecl.php.net/package/yaf
这里有两个坑,
最开始是用3.0.4版本编译的,但是3.0.4需要PHP7的支持,所以就歇菜了
用2.2.9版本编译出错,上网查了下yaf作者建议直接用2.3.3版本,于是换2.3.3版本就直接成功了,囧
2.给PHP添加动态扩展
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
3.在上面所提到的php.ini文件中加入
extension=yaf.so
4.重启PHP-FPM
至此,基本环境搭建结束,然后就可以按照http://www.laruence.com/manual/中所述写一个hello world了~