php linux 环境安装配置 及 扩展安装
2017-03-14 19:56
567 查看
在最新的版本5.6.3不仅修改了多个Bug,并且修改了fileinfo模块里存在的安全漏洞。
PHP团队推荐使用PHP5.6系列的用户,升级到最新版本5.6.3以上。
简单介绍一下,如何在CentOS上安装PHP5.6。
配置yum源
追加CentOS 6.5的epel及remi源。
PHP团队推荐使用PHP5.6系列的用户,升级到最新版本5.6.3以上。
简单介绍一下,如何在CentOS上安装PHP5.6。
配置yum源
追加CentOS 6.5的epel及remi源。
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm[/code]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm[/code]
以下是CentOS 7.0的源。# yum install epel-release # rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm[/code]
使用yum list命令查看可安装的包(Packege)。# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
安装PHP5.6
yum源配置好了,下一步就安装PHP5.6。# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
用PHP命令查看版本。# php --version PHP 5.6.0 (cli) (built: Sep 3 2014 19:51:31) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
在这里安装的版本是PHP5.6.0,细心的用户可能已经发现ZendGuardLoader变成Zend OPcahe了。
对从PHP5.5开始PHP代码缓存从APC变成了Zend OPcache了。
安装mongodb扩展wgwt http://pecl.php.net/get/mongodb-1.2.5.tgz tar zxf mongodb-1.2.5.tgz cd mongo-1.2.5 /usr/bin/phpize ./configure make &&make install
#php.ini添加extension=mongodb.so
安装php-fpmyum --enablerepo=remi,remi-php56 install php-fpm php-common php-mysql php-opcache php-pear php-gd php-devel php-mbstring php-mcrypt php-cli php-pdo php-xml -y
安装
memcache 的工作就是在专门的机器的内存里维护一张巨大的hash表,来存储经常被读写的一些数组与文件,从而极大的提高网站的运行效率,减轻后端数据库的读写压力。
实验环境:centos 6.6 x86_64
1、在安装memcached之前需要安装libevent支持:# wget http://syslab.comsenz.com/downloads/linux/libevent-1.4.12-stable.tar.gz # tar zxvf libevent-1.4.12-stable.tar.gz # cd libevent-1.4.12-stable #./configure --prefix=/usr/local/libevent #make && make install
2、服务器端 memcached 的编译安装# wget http://syslab.comsenz.com/downloads/linux/memcached-1.4.5.tar.gz # tar zxvf memcached-1.4.5.tar.gz # cd memcached-1.4.5 # ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent/ # make && make install
3、客户端安装memcache步骤:# wget http://www.lishiming.net/data/attachment/forum/memcache-2.2.3.tgz # tar zxvf memcache-2.2.3.tgz # cd memcache-2.2.3 # /usr/php/bin/phpize # ./configure --with-php-config=/usr/bin/php-config --enable-memcache # make
1)安装libevent库wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz tar zxvf libevent-2.0.20-stable.tar.gz cd libevent-2.0.20-stable/ /usr/bin/phpize ./configure --prefix=/usr/local/libevent/ make make install
(2)安装libevent扩展(http://pecl.php.net/package/libevent)wget http://pecl.php.net/get/libevent-0.1.0.tgz tar -zxvf libevent-0.1.0.tgz cd libevent-0.1.0 /usr/bin/phpize ./configure --with-php-config=/usr/bin/php-config --with-libevent=/usr/local/libevent/ make && make install
#php.ini添加extension=libevent.so
三 配置php.ini文件
首先通过phpinfo函数,找到php.ini的路径,我的是:/etc/php.ini
在其中添加如下内容:extension=memcache.so [Memcache] memcache.allow_failover = 1 memcache.max_failover_attempts=20 memcache.chunk_size =8192
开机自启chkconfig php-fpm on加入服务
chkconfig --add nginx chkconfig --add php-fpm开机自启
chkconfig nginx on chkconfig php-fpm on
CentOS环境中安装SSH2扩展,顺带记录下来,以备后面如果有需要用到的时候参考。
备注说明:如果我们需要在正式环境中直接运行,建议还是先在测试机中调试后再使用或者备份好数据,以免可能造成的问题。
第一、安装支持库文件yum install php-devel php-pear libssh2 libssh2-devel -y
直接登录SSH客户端,然后执行命令回车,安装需要的库文件。
第二、安装SSH2扩展pecl install -f ssh2
最后就能开心的玩耍了。
相关文章推荐
- Linux环境FastDFS分布式文件系统及PHP扩展库的安装与配置
- 在Linux上安装Gearman及配置使用Gearman的PHP扩展环境
- linux环境下安装配置PHP开发环境
- Linux下安装、配置PHP环境
- Linux下安装、配置PHP环境
- 64位Linux环境安装PHP TCC 扩展方法
- Linux下配置PHP运行环境 安装Oracle(粗略写了下)
- LAMP攻略: LAMP环境搭建,Linux下Apache,MySQL,PHP安装与配置
- Linux下,配置WordPress时出现“您的PHP似乎没有安装运行WordPress所必需的MySQL扩展”
- Linux下PHP安装配置MongoDB数据库连接扩展
- LAMP攻略: LAMP环境搭建,Linux下Apache,MySQL,PHP安装与配置
- LAMP攻略: LAMP环境搭建,Linux下Apache,MySQL,PHP安装与配置
- Linux下配置PHP运行环境 安装Oracle(粗略写了下)
- php扩展和嵌入--如何在linux下配置LAMP环境
- 第四篇(1):企业常用Linux web环境安装配置(apache、php、mysql)
- Linux下PHP安装配置MongoDB数据库连接扩展
- 在Linux上面搭建php环境和安装扩展
- 阿里云服务器下安装LAMP环境(CentOS Linux 6.3) 安装与配置 php
- Linux下配置安装PHP环境
- Linux下PHp的环境详细安装配置