备注:

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. selenuim爬虫实战(日lofter.com)

    LOFTER是网易公司2011年8月下旬推出的一款轻博客产品. LOFTER专注于为用户提供简约.易用.有品质.重原创的博客工具.原创社区,以及有品质的手机博客应用. LOFTER首次采用独立域名,口 ...

  2. VS Code直接调试Angular代码

    安装VS Code扩展 安装Debugger for Chrome 安装Debugger for Firefox 配置Launch.json文件 Launch.json文件的创建和生成我们可以利用VS ...

  3. dedecms中如何去掉文章页面的广告

    在arcticle_arcticle.htm页面找到广告调用代码{dede:myad name='myad'/}全部去掉就好了,如果要换成自己的广告,就换广告位标识 myad 就可以了

  4. maven 完整的settings.xml

    maven 完整的settings.xml <?xml version="1.0" encoding="UTF-8"?> <!-- Licen ...

  5. VS2008 对话框编辑器“即时预览”

    之前在VS2008中利用资源编辑器修改完对话框资源后,总是重新编译一下,然后Ctrl+F5运行来预览修改的效果,不断修改,不断编译,导致很费时,效率低下. 今天,发现了一个很好用的功能“Test Di ...

  6. linux默认的目录介绍

    http://www.cnblogs.com/shishm/archive/2011/11/03/2234954.html

  7. Hibernate_day01--课程安排_Hibernate概述_Hibernate入门

    Hibernate_day01 Hibernate课程安排 今天内容介绍 WEB内容回顾 JavaEE三层结构 MVC思想 Hibernate概述 什么是框架 什么是hibernate框架(重点) 什 ...

  8. insmod 内核模块参数传递

    对于如何向模块传递参数,Linux kernel 提供了一个简单的框架.其允许驱动程序声明参数,并且用户在系统启动或模块装载时为参数指定相应值,在驱动程序里,参数的用法如同全局变量. 通过宏modul ...

  9. AssetsManager 在ios更新失败解决方案

    AssetsManager在安卓平台使用正常,但是到ios就不行了,最后发现是 cocos2d\cocos\network\CCDownloader-apple.mm中的 - (void)URLSes ...

  10. iOS-多线程的底层实现

    (1)首先回答什么是线程 1个进程要想执行任务,必须得有线程.线程是进程的基本执行单元,一个进程(程序)的所有任务都在线程中执行 (2)什么是多线程 1个进程中可以开启多条线程,每条线程可以并行(同时 ...