php源码安装
要用swoole,首先需要有PHP环境。由于swoole的某些特性,最好是能够从源码编译安装PHP,这样在使用过程中可以避免很多不必要的错误。PHP下载地址:http://php.net/在这里挑选你想用的版本即可。下载源码包后,解压至本地任意目录(保证读写权限),留待使用。安装PHP前,需要安装编译环境和PHP的相关依赖。下面是相关命令:Ubuntu环境下:
sudo apt-get install build-essential gcc g++ autoconf libiconv-hook-dev libmcrypt-dev libxml2-dev libmysqlclient-dev libcurl4-openssl-dev libjpeg8-dev libpng12-dev libfreetype6-dev
CentOS环境下:
yum -y install 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 bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gd gd2 gd-devel gd2-devel perl-CPAN pcre-devel
(注:以上命令是我在实际使用中验证过的可以使用的,可能会和其他教程提供的命令不同)当上述命令执行后,即可开始安装PHP。命令如下:
cd php-5.5.10/
./configure --prefix=/usr/local/php --with-config-file-path=/etc/php --enable-fpm --enable-pcntl --enable-mysqlnd --enable-opcache --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --enable-zip --enable-ftp --enable-soap --enable-xml --enable-mbstring --disable-rpath --disable-debug --disable-fileinfo --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pcre-regex --with-iconv --with-zlib --with-mcrypt --with-gd --with-openssl --with-mhash --with-xmlrpc --with-curl --with-imap-ssl
sudo make
sudo make install
sudo cp php.ini-development /etc/php/
至此,PHP已经成功安装,但是此时在终端里是无法直接通过php --version查看php版本的还需要将PHP的可执行目录添加到环境变量中。使用Vim/Sublime打开~/.bashrc,在末尾添加如下内容:
export PATH=/usr/local/php/bin:$PATH
export PATH=/usr/local/php/sbin:$PATH
保存后,终端输入命令:
source ~/.bashrc
此时即可通过php --version查看php版本,看到如下内容:
PHP 5.5.10 (cli) (built: Apr 26 2014 09:46:14)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
即说明安装成功。
memcached扩展:
1、wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
2、tar -zxvf libmemcached-1.0.18.tar.gz
./configure make && make install
3、 wget http://pecl.php.net/get/memcached-2.2.0.tgz
tar -zxvf memcached-2.2.0.tgz
phpize
./configure make && make install
vi /etc/php/php.ini
extension = memcached.so
redis扩展:
1、https://github.com/phpredis/phpredis.git
cd phpredis/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
vi /etc/php/php.ini
extension=redis.so
mongo扩展:
1、wget http://pecl.php.net/get/mongo-1.5.8.tgz
tar -zxvf mongo-1.5.8.tgz
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
vi /etc/php/php.ini
extension=mongo.so
转自http://blog.csdn.net/yhl27/article/details/42278251
测试可行。
php源码安装的更多相关文章
- mono-3.4.0 源码安装时出现的问题 [do-install] Error 2 [install-pcl-targets] Error 1 解决方法
Mono 3.4修复了很多bug,继续加强稳定性和性能(其实Mono 3.2.8 已经很稳定,性能也很好了),但是从http://download.mono-project.com/sources/m ...
- 搭建LNAMP环境(七)- PHP7源码安装Memcached和Memcache拓展
上一篇:搭建LNAMP环境(六)- PHP7源码安装MongoDB和MongoDB拓展 一.安装Memcached 1.yum安装libevent事件触发管理器 yum -y install libe ...
- 搭建LNAMP环境(二)- 源码安装Nginx1.10
上一篇:搭建LNAMP环境(一)- 源码安装MySQL5.6 1.yum安装编译nginx需要的包 yum -y install pcre pcre-devel zlib zlib-devel ope ...
- 搭建LNAMP环境(一)- 源码安装MySQL5.6
1.yum安装编译mysql需要的包 yum -y install gcc-c++ make cmake bison-devel ncurses-devel perl 2.为mysql创建一个新的用户 ...
- Greenplum 源码安装教程 —— 以 CentOS 平台为例
Greenplum 源码安装教程 作者:Arthur_Qin 禾众 Greenplum 主体以及orca ( 新一代优化器 ) 的代码以可以从 Github 上下载.如果不打算查看代码,想下载编译好的 ...
- salt源码安装软件和yum安装软件
上面简单列出了源码安装的sls文件书写思路. 涉及到一些固定的思路:如, 1,拷贝 解压安装时候需要依赖tar.gz存在 如果已安装则无需再次安装. 2,启动脚本 加入chk时候需要文件存在,如果已添 ...
- 搭建LNAMP环境(六)- PHP7源码安装MongoDB和MongoDB拓展
上一篇:搭建LNAMP环境(五)- PHP7源码安装Redis和Redis拓展 一.安装MongoDB 1.创建mongodb用户组和用户 groupadd mongodb useradd -r -g ...
- 搭建LNAMP环境(三)- 源码安装Apache2.4
上一篇:搭建LNAMP环境(二)- 源码安装Nginx1.10 1.yum安装编译apache需要的包(如果已经安装,可跳过此步骤) yum -y install pcre pcre-devel zl ...
- Linux MySQL源码安装缺少ncurses-devel包
在Red Hat Enterprise Linux Server release 5.7 上用源码安装MySQL-5.6.23时,遇到了" remove CMakeCache.txt and ...
- centos 6x系统下源码安装mysql操作记录
在运维工作中经常部署各种运维环境,涉及mysql数据库的安装也是时常需要的.mysql数据库安装可以选择yum在线安装,但是这种安装的mysql一般是系统自带的,版本方面可能跟需求不太匹配.可以通过源 ...
随机推荐
- 微信公众平台开发3:订阅事件subscribe处理
新用户关注微信公众平台,将产生一个订阅事件,即subscribe事件,默认代码中没有对这一事件进行相应处理. 在新用户关注公众平台后,可能想知道该平台提供了哪些功能,以及怎样使用该平台,通俗一点讲就是 ...
- Ajax过程
http://www.cnblogs.com/daicunya/p/6227550.html 1.创建XMLHttpRequest对象,也就是创建一个异步调用对象. 2.创建一个新的HTTP请求,并指 ...
- BZOJ1508 : [NOI2003]Game
a[i][j]:i移动一根变成j是否可能 b[i][j]:i增加一根变成j是否可能 枚举在一个数字中移动的情况以及在两个数字中移动的情况 #include<cstdio> #include ...
- 产品原型设计工具 Balsamiq Mockups(转)
Balsamiq Mockups是产品设计师绘制线框图或产品原型界面的利器.在产品设计的需求阶段,低保真的线框图或者草图设计介于产品流程设计与高保真DEMO设计之间,在Balsamiq Mockups ...
- Brief introduction to Scala and Breeze for statistical computing
Brief introduction to Scala and Breeze for statistical computing 时间 2013-12-31 03:17:19 Darren Wilk ...
- lucene索引日期和数字
1.用途. 索引数字的场景主要有两种:一是把它们当作字符串一样处理,比如“要是搁以前,术士能暴击10000多,有木有!”中的"10000",它和其它的词没什么区别,你可以把它仅仅想 ...
- BZOJ 1051 受欢迎的牛(Tarjan缩点)
1051: [HAOI2006]受欢迎的牛 Time Limit: 10 Sec Memory Limit: 162 MB Submit: 4573 Solved: 2428 [Submit][S ...
- NBUT 1635 Explosion(最小顶点覆盖)
[1635] Explosion 时间限制: 10000 ms 内存限制: 65535 K 问题描述 there is a country which contains n cities connec ...
- 【转】asp.net c# 网上搜集面试题目大全(附答案)
asp.net c# 网上搜集面试题目大全(附答案) http://www.cnblogs.com/hndy/articles/2234188.html
- .NET开发问题汇总
问题一: mvc 部署到iis 提示错误未能加载文件或程序集System.Web.Http.WebHost 解决方案: Nuget程序包管理 —>程序包管理控制台,运行以下命令即可:Update ...