centos6.5 nginx+php+mysql之php5.4安装

一.安装前的准备

cd /usr/local/src/

yum -y install libmcrypt-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel


二.安装PHP

下载PHP

wget http://cn2.php.net/distributions/php-5.4.38.tar.gz

tar -zxvf php-5.4.38.tar.gz

cd php-5.4.38

./configure --prefix=/usr/local/php  --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

此时出现报错:configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决方法:

rpm -ivh "http://www.lishiming.net/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm"

yum install -y libmcrypt-devel

再次

./configure --prefix=/usr/local/php  --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

make all install


cd /usr/local/php

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


vi /usr/local/php/etc/php-fpm.conf

修改后保存:

user = www-php

group = www-php


添加用户

groupadd www-php

useradd -g www-php www-php


编译nginx

在server段添加:

# 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测试文件

vi /usr/local/nginx/html/index.php 

添加以下内容:


<?php

    echo phpinfo();

?>

~       

启动nginx:

/usr/local/nginx/nginx

启动php

/usr/local/php/sbin/php-fpm


测试:

links 192.168.66.176/index.php   其中192.168.66.176为IP地址


测试结果显示PHP版本等信息为OK



本文转自 yawei555 51CTO博客,原文链接:http://blog.51cto.com/huwei555/1618742,如需转载请自行联系原作者

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值