php编译安装

yum install bison flex libxml2-devel openssl-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel  freetype-devel  t1lib-devel libicu-devel

#安装libiconv(解压过程略)
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
 ./configure --prefix=/usr/local/libiconv
make
make install #安装mhash(解压过程略) wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.bz2 ./configure make make install #安装libmcrypt(解压过程略) wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz ./configure make make install

 

 

1、报错信息:

1
checking for known struct flock definition... configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no
 

 

2、解决办法:

 

1
2
3
4
vim /etc/ld.so.conf.d/local.conf     # 编辑库文件
/usr/local/lib                       # 添加该行
:wq                                  # 保存退出
ldconfig -v                          # 使之生效

 

3、注意事项:

这里添加的库文件路径一定要和你系统平台arch一致,32bit的系统直接添加/usr/local/lib即可,64bit系统要填加/usr/local/lib64.否则依旧会报错,我当时就是添加了/usr/local/lib死活编辑不了,后来更改为

/usr/local/lib64才可以。切记

 

解压php文件

./configure --prefix=/usr/local/php --enable-fastcgi --enable-fpm --with-mcrypt --with-zlib --enable-mbstring --disable-pdo --with-curl --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-xml --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-xslt --enable-memcache --enable-zip --with-pcre-regex --with-mysql --with-iconv=/usr/local/libiconv --with-libdir=lib64

 

 

http://my.oschina.net/lijialong/blog/110489

http://blog.chinaunix.net/uid-20639775-id-3044237.html

http://www.cnblogs.com/hujiong/archive/2013/02/20/2918509.html

 

 

 

其中server段增加如下配置,注意标红内容配置,否则会出现No input file specified.错误

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

 

四、创建测试php文件

创建php文件

在/usr/local/nginx/html下创建index.php文件,输入如下内容

<? echo phpinfo(); ?>

 

五、启动服务

启动php-fpm和nginx

/usr/local/php/sbin/php-fpm (手动打补丁的启动方式/usr/local/php/sbin/php-fpm start)

 

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

sudo /usr/local/nginx/nginx

posted @ 2016-08-25 01:20  li-xingtao  阅读(241)  评论(0编辑  收藏  举报