备注:

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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. [环境配置]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 ...

  4. [笔记] Ubuntu 18.04源码编译安装OpenCV 4.0流程

    标准常规安装方法安装的OpenCV版本比较低,想尝鲜使用4.0版本,只好源码安装. 安装环境 OS:Ubuntu 18.04 64 bit 显卡:NVidia GTX 1080 CUDA:10.0 c ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. [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 ...

  9. Ubuntu 16.04 源码方式安装 JDK

    1.去官网下载JDK http://www.oracle.com/technetwork/articles/javase/index-jsp-138363.html 2.下载完成后,创建一个我们将要安 ...

随机推荐

  1. java为安全起见对Applet有所限制

    Applet消亡的原因: ①java为安全起见对Applet有所限制:Applet不允许访问本地文件信息.敏感信息,不能执行本地指令(比如FORMAT),不能访问初原服务器之外的其他服务器. ① IE ...

  2. 负margin应用案例几则(转载+总结)

    (一)自适应布局——左栏改右栏 这里先写个一列固定列宽,另一列自适应的两列布局,效果图: 侧栏移至右边,效果图: 其HTML <div class="wrap"> &l ...

  3. Loadrunner如何遍历一个页面中的url并进行访问?

    最近在网上到一个关于loadrunner遍历一个页面中的url并进行访问的脚本,就把它用我们自己的项目实践了一下,发现有一点不完善. 原始版本: Action(){char temp[64];int ...

  4. requirejs源码分析,使用注意要点

    本文将深度剖析require.js代码,为了是大家更高效.正确的去使用它,本文不会介绍require的基本使用! 概要 先来一个流程图来概要一下大概流程 在require中,根据AMD(Asynchr ...

  5. ETL概念,ETL流程

    ETL是将业务系统的数据经过抽取.清洗转换之后加载到数据仓库的过程,目的是将企业中的分散.零乱.标准不统一的数据整合到一起,为企业的决策提供分析依据. ETL是BI项目重要的一个环节. 通常情况下,在 ...

  6. JSON.parse() 和 JSON.stringify() 的区别

    JSON.parse()与JSON.stringify()的区别   JSON.parse()[从一个字符串中解析出json对象] //定义一个字符串 var data='{"name&qu ...

  7. C++ enum 枚举类型

    1. 枚举类型浅谈 假设我们要设计一个打开文件的函数, 打开文件由三种状态: input, output 和 append. 不使用枚举, 我们可能会写出如下的代码 const int input = ...

  8. ios 如何改变UISegmentedControl文本的字体大小?

    UIFont *Boldfont = [UIFont boldSystemFontOfSize:16.0f]; NSDictionary *attributes = [NSDictionary dic ...

  9. angular2+ 自定义pipe管道实例--定义全局管道及使用

    首先到项目目录下ng g pipe pipe/myslice 就会在app目录下生成一个pipe文件夹文件夹下有myslice.pipe.ts文件,如果没有也可以自己手动新建 然后需要再app.mod ...

  10. Python--上传文件和下载文件

    #!/usr/bin/env python# -*- coding: utf-8 -*-# @Time : 2017/12/28 13:56# @Author : Aries# @Site : # @ ...