Write the Code. Change the World.

1月 02

0.00 avg. rating (0% score) - 0 votes

非root用户手动安装php nginx和php-fmp
到官网下载php5.6源码安装包

~/py/php-5.6.29> ./configure --prefix=/home/tjdf/py/php56
报错
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.

添加开发工具光盘安装源
/data # tar -xzvf SLES-11-SP3-SDK-x86_64.tar.gz
/data/SLES-11-SP3-SDK/CD1 # zypper ar /data/SLES-11-SP3-SDK/CD1 suse11sp3sdk

安装 libxml2-devel
/data/SLES-11-SP3-SDK/CD1 # zypper in libxml2-devel

~/py/php-5.6.29> ./configure --prefix=/home/tjdf/py/php56
~/py/php-5.6.29> make
~/py/php-5.6.29> make test
~/py/php-5.6.29> make install
~/py/php-5.6.29> cd ..
安装nginx
~/py> wget http://nginx.org/download/nginx-1.10.2.tar.gz
~/py> tar -xzvf nginx-1.10.2.tar.gz

~/py> cd nginx-1.10.2/
~/py/nginx-1.10.2> ./configure --prefix=/home/tjdf/py/nginx1102
checking for PCRE library ... not found
checking for PCRE library in /usr/local/ ... not found
checking for PCRE library in /usr/include/pcre/ ... not found
checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... not found

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

安装pcre库
/data/SLES-11-SP3-SDK/CD1 # zypper in pcre-devel
The following NEW packages are going to be installed:
libstdc++-devel libstdc++43-devel pcre-devel

重新编译安装
~/py/nginx-1.10.2> ./configure --prefix=/home/tjdf/py/nginx1102
~/py/nginx-1.10.2> make
~/py/nginx-1.10.2> cd ..
~/py> cd nginx1102/
~/py/nginx1102> ls
conf  html  logs  sbin
~/py/nginx1102> cd sbin
~/py/nginx1102/sbin> ls
nginx
~/py/nginx1102/sbin> cd ..
~/py/nginx1102> cd conf/
~/py/nginx1102/conf> ls -l
启动php-cgi程序
~/py/php56/bin> ./php-cgi -b 127.0.0.1:9000&
由于php-cgi会经常退出,导致页面无法访问,后面又加了php-fmp的安装

配置nginx
~/py/nginx1102/conf> vi nginx.conf
server {
listen       8999;
server_name  localhost;
root /home/tjdf/py/supervisord-monitor-master/public_html;
index index.php;
#charset koi8-r;

#access_log  logs/host.access.log  main;

location ~* \.php$ {
include fastcgi.conf;
#      include include/supervisord.add.net/env.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
修改监听端口
配置root默认页面
添加fastcgi 配置

启动nginx
~/py/nginx1102> sbin/nginx

重新编译安装php 添加fpm模块
/home/tjdf/py/php-5.6.29
~/py/php-5.6.29> ./configure --prefix=/home/tjdf/py/php56  --enable-fpm --with-mcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug  --disable-rpath --enable-inline-optimization --with-bz2  --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir
会报这几个包缺少
checking for BZip2 support... yes
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
configure: error: jpeglib.h not found.
configure: error: png.h not found.
configure: error: mcrypt.h not found. Please reinstall libmcrypt.

需要装这些
~ # zypper in libbz2-devel
~ # zypper in libjpeg-devel
~ # zypper in libpng-devel
~ # zypper in libmcrypt-devel

~/py/php-5.6.29> ./configure --prefix=/home/tjdf/py/php56  --enable-fpm --with-mcrypt --enable-mbstring --disable-pdo --with-curl --disable-debug  --disable-rpath --enable-inline-optimization --with-bz2  --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli --with-gd --with-jpeg-dir
~/py/php-5.6.29> make
~/py/php-5.6.29> make test
~/py/php-5.6.29> make install

修改php-fmp配置
~/py/php56/sbin> cp ../etc/php-fpm.conf.default ../etc/php-fpm.conf
~/py/php56/etc> vi php-fpm.conf.default
修改监听端口为127.0.0.1 9000

启动php-fmp
~/py/php56/sbin> ./php-fpm
[17-Dec-2016 07:59:43] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[17-Dec-2016 07:59:43] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
~/py/php56/sbin> ps -ef|grep php
tjdf      93833      1  0 07:59 ?        00:00:00 php-fpm: master process (/home/tjdf/py/php56/etc/php-fpm.conf)
tjdf      93834  93833  0 07:59 ?        00:00:00 php-fpm: pool www
tjdf      93835  93833  0 07:59 ?        00:00:00 php-fpm: pool www
tjdf      93844  97656  0 07:59 pts/7    00:00:00 grep php
~/py/php56/sbin> ps -ef|grep php

参考 nginx php-fpm安装配置

(原创)SUSE Linux 11里Nginx+Resin+JSP+Memcached+MySQL安装配置整合

Linux上配置Nginx+PHP5(FastCGI)

© 2017, 新之助meow. 原创文章转载请注明: 转载自http://www.xinmeow.com

0.00 avg. rating (0% score) - 0 votes