Ubuntu 16.04 源码编译安装PHP7+swoole
备注:
Ubuntu 16.04 Server 版安装过程图文详解
Ubuntu16镜像地址: 链接:https://pan.baidu.com/s/1XTVS6BdwPPmSsF-cYF6B7Q 密码:9ecm
php-7.0.9:链接:https://pan.baidu.com/s/1Sf5QA9gDZhD5JcZmXhlWvw 密码:ketc
nghttp2:链接:https://pan.baidu.com/s/10FQ_YqBWvPqiUL0aU4U9Yw 密码:f3n2
swoole-4.1.2:链接:https://pan.baidu.com/s/16qgFf54gM4jfz9Ok3_ivYQ 密码:px3c
hiredis-0.13.3:链接:https://pan.baidu.com/s/1VfopPRcQLXUA-s14htNNpA 密码:ml6l
ubuntu 16.04配置静态ip
sudo vim /etc/network/interfaces
auto ens33
iface ens33 inet static
address 192.168.8.100
netmask 255.255.255.0
gateway 192.168.8.2
dns-nameservers 218.2.135.1 8.8.8.8
Mac链接linux系统 直接在终端 ssh -p 22 root@101.200.86.233 root是用户名
一、下载PHP7的最新版源码
https://pan.baidu.com/s/19-fkSSuqnNoJ4-eMJH-QGQ
二、解压
tar -zxf php-7.0.9.tar.gz
三、安装相关依赖库
sudo apt-get update
sudo apt-get install libxml2-dev
#安装gcc
sudo apt-get install build-essential
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install make
sudo apt-get install curl
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libpng-dev
sudo apt-get install libmcrypt-dev
sudo apt-get install libreadline6 libreadline6-dev
sudo apt-get install libreadline-dev
或者一次性安装:
sudo apt-get -y install build-essential openssl libssl-dev make curl libcurl4-gnutls-dev libjpeg-dev libpng-dev libmcrypt-dev libreadline6 libreadline6-dev libreadline-dev
四、编译:(编译参数2个中选择一个,第一段大部分机器即可编译,第二段参数推荐64位x86系统编译)
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts
./configure --prefix=/usr/local/php --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --with-mysql --with-mysqli --with-mysql-sock --enable-pdo --with-pdo-mysql --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --enable-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear --with-libdir=/lib/x86_64-linux-gnu --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --enable-xml
本系统采用第二种编译方式
如果报错请运行:
apt-get install build-essential libexpat1-dev libgeoip-dev libpng-dev libpcre3-dev libssl-dev libxml2-dev rcs zlib1g-dev libmcrypt-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libwebp-dev pkg-config
五、执行make 和 sudo make install 安装
make && sudo make install
六、配置php-fpm
cd /usr/local/php/etc sudo cp php-fpm.conf.default php-fpm.conf cd /usr/local/php/etc/php-fpm.d sudo cp www.conf.default www.conf user = www
group = www 如果www用户不存在,那么先添加www用户
sudo groupadd www
sudo useradd -g www www
七、验证PHP
/usr/local/php/bin/php -v
八、启动php-fpm
sudo /usr/local/php/sbin/php-fpm
九、将php加入到全局配置中
sudo vim /etc/profile
末尾加入2行
PATH=$PATH:/usr/local/php/bin
export PATH
最后执行
source /etc/profile
十、安装swoole
wget https://pecl.php.net/get/swoole-4.1.2.tgz
tar xzf swoole-4.1.2.tgz
cd swoole-4.1.2
sudo phpize (ubuntu 没有安装phpize可执行命令:sudo apt-get install php-dev来安装phpize)
./configure --enable-coroutine --enable-openssl --enable-http2 --enable-async-redis --enable-sockets --enable-mysqlnd
make && sudo make install
备注: 如果安装http2需要安装nghttp2
wget https://github.com/nghttp2/nghttp2/releases/download/v1.30.0/nghttp2-1.30.0.tar.bz2
tar -jxvf nghttp2-1.30.0.tar.bz2
cd nghttp2-1.30.0
./configure
make && sudo make install 如果安装--enable-async-redis需要安装hiredis
wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz
tar xzf v0.13.3.tar.gz
cd hiredis-0.13.3/
make && sudo make install
配置hiredis
sudo mkdir /usr/lib/hiredis
sudo cp /usr/local/lib/libhiredis.so /usr/lib/hiredis
sudo mkdir /usr/include/hiredis
sudo cp /usr/local/include/hiredis/hiredis.h /usr/include/hiredis
sudo vim /etc/ld.so.conf
文件末尾添加 /usr/local/lib
sudo ldconfig
查询php.ini的位置
php -i |grep php.ini
安装mbstring扩展
sudo apt-get install php7.0-mbstring
php.ini中加入mbstring.so
安装composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
安装swoft
composer create-project swoft/swoft swoft
cd swoft
composer update
Ubuntu 16.04 源码编译安装PHP7+swoole的更多相关文章
- Ubuntu 16.04 源码编译安装PHP7
一.下载PHP7的最新版源码 php7.0.9 下载地址 http://php.net/get/php-7.0.9.tar.gz/from/a/mirror 二.解压 tar -zxf /tmp/p ...
- Ubuntu 16.04源码编译安装nginx 1.10.0
一.下载相关的依赖库 pcre 下载地址 http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.t ...
- [环境配置]Ubuntu 16.04 源码编译安装OpenCV-3.2.0+OpenCV_contrib-3.2.0及产生的问题
1.OpenCV-3.2.0+OpenCV_contrib-3.2.0编译安装过程 1)下载官方要求的依赖包 GCC 4.4.x or later CMake 2.6 or higher Git GT ...
- [笔记] Ubuntu 18.04源码编译安装OpenCV 4.0流程
标准常规安装方法安装的OpenCV版本比较低,想尝鲜使用4.0版本,只好源码安装. 安装环境 OS:Ubuntu 18.04 64 bit 显卡:NVidia GTX 1080 CUDA:10.0 c ...
- ubuntu 16.04源码编译和配置caffe详细教程 | Install and Configure Caffe on ubuntu 16.04
本文首发于个人博客https://kezunlin.me/post/b90033a9/,欢迎阅读! Install and Configure Caffe on ubuntu 16.04 Series ...
- ubuntu 16.04源码编译OpenCV教程 | compile opencv on ubuntu 16.04
本文首发于个人博客https://kezunlin.me/post/15f5c3e8/,欢迎阅读! compile opencv on ubuntu 16.04 Series Part 1: comp ...
- Ubuntu 16.04源码编译boost库 编写CMakeLists.txt | compile boost 1.66.0 from source on ubuntu 16.04
本文首发于个人博客https://kezunlin.me/post/d5d4a460/,欢迎阅读! compile boost 1.66.0 from source on ubuntu 16.04 G ...
- [Part 3] 在Ubuntu 16.04源码编译PCL 1.8.1支持VTK和QT
本文首发于个人博客https://kezunlin.me/post/137aa5fc/,欢迎阅读! Part-3: Install and Configure PCL 1.8.1 with vtk q ...
- Ubuntu 16.04 源码方式安装 JDK
1.去官网下载JDK http://www.oracle.com/technetwork/articles/javase/index-jsp-138363.html 2.下载完成后,创建一个我们将要安 ...
随机推荐
- 多媒体开发之分场图像和交错图像interlacing---一个破解版的迅雷云点播网站
[-] 目录 编辑描述 编辑去交错方法 编辑去交错源自电影的影像 编辑去交错交错式影像 编辑单一场去交错intra-field deinterlacing 编辑场间去交错inter-field dei ...
- (转)c指针问题
字符串常量问题: http://blog.csdn.net/zhongyili_sohu/article/details/8084188 1. 常量字符串 在代码里直接出现的”abcdef”这种字符串 ...
- 运动目标检测ViBe算法
一.运动目标检测简介 视频中的运动目标检测这一块现在的方法实在是太多了.运动目标检测的算法依照目标与摄像机之间的关系可以分为静态背景下运动检测和动态背景下运动检测.先简单从视频中的背景类型来讨论. ...
- python入门(七):CGI编程
CGI CGI(Common Gateway Interface),通用网关接口,HTTP服务器与你的或其它机器上的程序进行“交谈”的一种工具,其程序须运行在网络服务器上. CGI在其中扮演的是在we ...
- iOS开发之--MVC 架构模式
随着项目开发时间的增加,从刚开始那种很随意的代码风格,逐渐会改变,现在就介绍下MVC的架构模式,MVC的架构模式,从字面意思上讲,即:MVC 即 Modal View Controller(模型 视图 ...
- 【黑金原创教程】【TimeQuest】【第三章】TimeQuest 扫盲文
声明:本文为黑金动力社区(http://www.heijin.org)原创教程,如需转载请注明出处,谢谢! 黑金动力社区2013年原创教程连载计划: http://www.cnblogs.com/al ...
- maven仓库加载本地包依赖
如果有个jar包是我们自己打的,怎么放到maven中呢? 首先在项目里面新建一个lib目录,如果有lib目录则不需要新建,然后放自己的jar包进去,maven的pom.xml配置是: <depe ...
- SQL使用union合并查询结果(转载)
1.UNION的作用 UNION 指令的目的是将两个 SQL 语句的结果合并起来.从这个角度来看, UNION 跟 JOIN 有些许类似,因为这两个指令都可以由多个表格中撷取资料. UNION 的一 ...
- 事务以及MySQL事务隔离级别+MySQL引擎的区别
1.事务的基本要素:ACID 1.原子性(Atomicity): 事务开始后所有操作,要么全部做完,要么全部不做,不可能停滞在中间环节.事务执行过程中出错,会回滚到事务开始前的状态,所有的操作就像没有 ...
- 自动生成项目的Makefile文件
自动生成项目的Makefile文件 理论基础 跟我一起写 Makefile: http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=4 ...