系统信息:

centOS6,PHP5.5

1.检查是否已经安装PHP。

yum list installed | grep php
rpm -qa | grep php
# 如果有,则卸载
rpm -e php-fpm-5.3.3-47.el6.x86_64 --nodeps

2.配置安装包源。

# Centos 5.X
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
# CentOs 6.x
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
# CentOs 7.X
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

3.执行安装。

yum list php*

问题:yum install libmcrypt libmcrypt-devel mcrypt mhash -y
报错:No package libmcrypt available.
解决方法:  //扩展包更新包
yum install epel-release

安装相关依赖依赖:

yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel
yum -y install php56w.x86_64
yum -y --enablerepo=webtatic install php56w-devel
yum -y install php56w-pdo php56w-xml php56w-gd php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-opcache.x86_64
yum -y install php56w-fpm
#设置php-fpm开机启动
chkconfig php-fpm on
#启动php-fpm
/etc/init.d/php-fpm start
# 查看PHP版本
php -v

4.yum安装默认位置查看。

where is php

/usr/bin/php-config
   --prefix 获取到安装目录 
   --libs 库文件
   --extension-dir 扩展文件
   --include-dir  头文件
   --php-binary php程序所在位置

/usr/bin/php-config --php-binary

/etc/init.d/php-fpm start

netstat -anp | grep 9000

http://211.149.239.182:9000/ 

配置Nginx支持PHP:

vi  /etc/nginx/conf.d/default.conf 

 解开Nginx.cnf里面的注释:

 

Logo

欢迎加入西安开发者社区!我们致力于为西安地区的开发者提供学习、合作和成长的机会。参与我们的活动,与专家分享最新技术趋势,解决挑战,探索创新。加入我们,共同打造技术社区!

更多推荐