php 5.6 nginx,Nginx 1.9+PHP5.6 环境搭建

1 PHP5.6

1下载安装包

#wget http://mirrors.sohu.com/php/php-5.6.2.tar.gz

#tar -zxf php-5.6.2?2安装php依赖的包??

#yum install gcc gcc-c++ libxml2 libxml2-devel libjpeg-devel libpng-devel freetype-devel openssl-devel libcurl-devel libmcrypt-devel3 安装 (-prefix是安装目录,-with-mysql是mysql的安装目录,由于我是用yum装的,所以不需要写-with-mysql=****哪里这样子,其他参数自行百度。)

#?./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-pcntl --enable-mysqlnd --enable-opcache --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --enable-zip --enable-ftp --enable-soap --enable-xml --enable-mbstring --disable-rpath --disable-debug --disable-fileinfo --with-mysql --with-mysqli --with-pdo-mysql --with-pcre-regex --with-iconv --with-zlib --with-mcrypt --with-gd --with-openssl --with-mhash --with-xmlrpc --with-curl --with-imap-ssl

?#make

#make install

若上几步都没报错的话就安装成功,有报错估计是少了点什么,用百度查查后yum一下吧。?

#cp php.ini-production /usr/local/php/etc/php.ini?

当我们使用nginx还要把php-fpm.conf放到/usr/local/php/etc/里头

cp/usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

接下来我们还可能需要将php-fpm作为server服务

?#cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

(/usr/local/src/php-5.6.17是PHP安装文件夹)??

设置权限,并添加服务

#chmod+x /etc/init.d/php-fpm

#chkconfig--add php-fpm

以后可以使用如下命令管理php-fpm了

#service php-fpm start

#service php-fpm stop

#service php-fpm restart

#service php-fpm reload

make:*** [sapi/cli/php] Error 1解决办法

ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor‘:

/usr/local/php/ext/iconv/iconv.c:2491: undefined reference to `libiconv_open‘collect2: ld returned 1exit status

make:*** [sapi/cli/php] Error 1# vi Makefile

在安裝 PHP 到系统中时要是发生「undefined reference to libiconv_open‘」之类的错误信息,那表示在「./configure 」沒抓好一些环境变数值。错误发生点在建立「-o sapi/cli/php」是出错,没給到要 link 的 iconv 函式库参数。

解决方法1:

编辑Makefile 大约77 行左右的地方: EXTRA_LIBS= ..... -lcrypt 在最后加上 -liconv,例如: EXTRA_LIBS = ..... -lcrypt -liconv 然后重新再次 make 即可。

解决方法2:

make ZEND_EXTRA_LIBS=‘-liconv‘ln-s /usr/local/lib/libiconv.so.2 /usr/lib64/configure: error: mcrypt.h not found. Please reinstall libmcrypt. 解决办法

wget http://124.205.69.134/files/817400000026D1DF/soft.vpser.net/web/libmcrypt/libmcrypt-2.5.8.tar.gz

./configure

make

make install

Don‘t know how to define struct flock on this system, set --enable-opcache=no 解决办法

vim /etc/ld.so.conf.d/local.conf # 编辑库文件/usr/local/lib # 添加该行

:wq # 保存退出

ldconfig-v # 使之生效2Nginx:

wget http://nginx.org/download/nginx-1.9.7.tar.gz

tar -zxvf nginx-1.9.7.tar.gz

cd nginx-1.9.7./configure --user=www --group=www --prefix=/usr/local/nginx-1.9.7 --with-http_stub_status_module

make;

make install

cd ..

vi/usr/local/nginx/conf/nginx.conf

...

location~\.php$ {

root html;

fastcgi_pass127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

错误提示:

./configure: error: the HTTP rewrite module requires the PCRE library.

安装pcre-devel解决问题

yum-y install pcre-devel

错误提示:

./configure: error: the HTTP cache module requires md5 functionsfrom OpenSSL library. You can either disable the module by using

--without-http-cache option, or install the OpenSSL library into the system,

or build the OpenSSL library staticallyfrom the source with nginx by using

--with-http_ssl_module --with-openssl=options.

解决办法:

yum-y install openssl openssl-devel3环境变量:

方法一:

直接运行命令export PATH=$PATH:/usr/local/webserver/php/bin 和 export PATH=$PATH:/usr/local/webserver/mysql/bin

使用这种方法,只会对当前会话有效,也就是说每当登出或注销系统以后,PATH 设置就会失效,只是临时生效。

方法二:执行vi~/.bash_profile修改文件中PATH一行,将/usr/local/webserver/php/bin 和 /usr/local/webserver/mysql/bin 加入到PATH=$PATH:$HOME/bin一行之后

这种方法只对当前登录用户生效

方法三:修改/etc/profile文件使其永久性生效,并对所有系统用户生效,在文件末尾加上如下两行代码

PATH=$PATH:/usr/local/webserver/php/bin:/usr/local/webserver/mysql/bin

export PATH

最后:执行 命令source/etc/profile或 执行点命令 ./profile使其修改生效,执行完可通过echo $PATH命令查看是否添加成功。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值