php linux 环境安装配置 及 扩展安装
来源:互联网 发布:淘宝小李子假货 编辑:程序博客网 时间:2024/06/01 15:54
在最新的版本5.6.3不仅修改了多个Bug,并且修改了fileinfo模块里存在的安全漏洞。
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
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
以下是CentOS 7.0的源。
# yum install epel-release# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用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 --versionPHP 5.6.0 (cli) (built: Sep 3 2014 19:51:31)Copyright (c) 1997-2014 The PHP GroupZend 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.tgztar zxf mongodb-1.2.5.tgzcd mongo-1.2.5/usr/bin/phpize./configuremake &&make install
#php.ini添加extension=mongodb.so
安装php-fpm
yum --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.gztar zxvf libevent-2.0.20-stable.tar.gzcd libevent-2.0.20-stable//usr/bin/phpize./configure --prefix=/usr/local/libevent/makemake install
(2)安装libevent扩展(http://pecl.php.net/package/libevent)
wget http://pecl.php.net/get/libevent-0.1.0.tgztar -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 nginxchkconfig --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
最后就能开心的玩耍了。
- php linux 环境安装配置 及 扩展安装
- FastDFS环境配置及php FastDFS扩展安装
- Linux环境FastDFS分布式文件系统及PHP扩展库的安装与配置
- 在Linux上安装Gearman及配置使用Gearman的PHP扩展环境
- linux环境下安装php扩展
- linux环境编译安装php的扩展
- linux环境安装php fileinfo扩展
- 在linux环境下安装php扩展
- linux安装配置PHP环境
- 安装redis及配置php扩展
- 安装php swoole框架 环境搭建及扩展安装
- [李景山php] php扩展开发系列--环境准备及安装
- [李景山php] php扩展开发系列--环境准备及安装
- sphinx服务器安装及配置详解 安装PHP sphinx扩展
- linux php安装扩展
- linux安装php扩展
- Apache+PHP+Mysql安装及环境配置
- 新手安装及配置PHP开发环境
- Android性能优化之内存优化
- HBase BlockCache机制讲解&源码分析
- [Leetcode] Convert Sorted Array to Binary Search Tree
- Python学习笔记-import
- idea 安装过程
- php linux 环境安装配置 及 扩展安装
- Vue学习之路---No.4(分享心得,欢迎批评指正)
- 排序算法总结【内排序】
- c3p0和QueryRunner的结合使用,让开发更加简便
- 202. Happy Number
- Proteus仿真AT89C52——INT
- BZOJ 1655 [Usaco2006 Jan] Dollar Dayz 奶牛商店 完全背包
- amazon亚马逊Review Feedback点赞评论评价刷评 防关联虚拟机系统
- Android Studio运行时 ERROR: Could not initialize OpenglES emulation, use '-gpu off' to disable it.