美文网首页
ubuntu下php7+nginx+swoole+yaf

ubuntu下php7+nginx+swoole+yaf

作者: 正义的西瓜 | 来源:发表于2016-06-19 18:43 被阅读0次

    环境

    ubuntu: 14.04
    php: 7.0.10
    nginx: 1.10.1
    swoole:1.8.9
    mysql: 5.7.13
    redis: 3.2.1
    yaf: 3.0.2
    

    编译环境

    更新ubuntu:
    apt-get update 
    apt-get upgrade 
    编译php所需编译工具以及依赖包:
    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 libpcre3 libpcre3-dev libssl-dev libxpm-dev
    

    安装php 7.0.10

    1.  wget http://cn2.php.net/distributions/php-7.0.10.tar.gz
    2. tar -zxvf php-7.0.10.tar.gz
    4. cd php-7.0.10
    5. ./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-soap \
    --enable-xml \
    --enable-mbstring \
    --disable-rpath \
    --disable-debug \
    --disable-fileinfo \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd \
    --with-pcre-regex \
    --with-iconv \
    --with-zlib \
    --with-mcrypt \
    --with-gd \
    --enable-gd-native-ttf \
    --with-png \
    --with-zlib-dir \
    --with-ttf \
    --with-jpeg-dir \
    --with-freetype-dir \
    --with-xpm-dir \
    --with-openssl \
    --with-mhash \
    --with-xmlrpc \
    --with-curl \
    --with-imap-ssl
    6. sudo make
    7. sudo make install
    8. sudo mkdir /etc/php
    9. sudo cp php.ini-development /etc/php/php.ini
    10. vim ~/.bashrc 在末尾加上两行
    export PATH=/usr/local/php/bin:$PATH
    export PATH=/usr/local/php/sbin:$PATH
    保存后执行:
    source ~/.bashrc
    10. php -v 即可看到版本
    
    mac:
    ./configure --prefix=/usr/local/php --with-apxs2=/usr/sbin/apxs --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=/usr/local/opt/gettext/ --disable-fileinfo --enable-maintainer-zts
    
    

    安装 swoole1.8.9

    1. wget https://github.com/swoole/swoole-src/archive/1.8.9-stable.tar.gz
    2. tar -zxvf 1.8.9-stable.tar.gz
    3. cd swoole-src-1.8.9-stable/
    4. phpize
    5. ./configure --with-php-config=/usr/local/php/bin/php-config
    6. sudo make && make install
    5. sudo vim /etc/php/php.ini 最后添加
    extension=swoole.so
    

    安装 nginx 1.11.3

    1. wget http://nginx.org/download/nginx-1.11.3.tar.gz
    2. tar -zxvf nginx-1.11.3.tar.gz
    3. cd nginx-1.11.3/
    4 . /configure --prefix=/usr/local/nginx  make && make install
    5.  cp /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
    2. vim /usr/local/nginx/conf/nginx.conf
            index index.html index.htm index.php;
            location ~ \.php$ {
                root html;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }
    3. sudo nginx 启动
       sudo nginx -s reload
    

    配置php-fpm

    1. cd /usr/local/php/etc/
    sudo cp php-fpm.conf.default php-fpm.conf
    2. cd /usr/local/php/etc/php-fpm.d/
    sudo mv www.conf.default www.conf
    3.  cd /usr/local/php/var/log/
    sudo chmod -R 777 php-fpm.log
    
    sudo /usr/local/php/sbin/php-fmp 启动php-fpm
    

    安装MySql 5.7.13

    1. wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.debsudo 
    2. dpkg -i mysql-apt-config_0.6.0-1_all.deb
    3. sudo  apt-get update
    4. sudo apt-get install mysql-server-5.7
    

    安装 Redis 3.2.1

    1. wget http://download.redis.io/releases/redis-3.2.1.tar.gz
    2. tar xzf redis-3.2.1.tar.gz
    3. cd redis-3.2.1
    4. make
    5. make install
    

    php7 安装redis扩展

    1. wget -c https://github.com/phpredis/phpredis/archive/php7.zip
    2. unzip php7.zip
    3. cd phpredis-php7
    4. /usr/local/php/bin/phpize
    5. ./configure --with-php-config=/usr/local/php7/bin/php-config
    6. make
    7. make install
    8. sudo vim /usr/local/php7/etc/php.ini
       中加入extension=redis.so并重启php-fpm
    

    yaf 安装

    1. wget http://pecl.php.net/get/yaf-3.0.2.tgz
    2. tar -zxvf yaf-3.0.2.tgz
    3. cd yaf-3.0.2/
    4. /usr/local/php/bin/phpize
    5. ./configure --with-php-config=/usr/local/php/bin/php-config
    6. make
    7. make test
    8. sudo make install
    9. sudo vim /usr/local/php7/etc/php.ini
       中加入extension=yaf.so并重启php-fpm
    

    相关文章

      网友评论

          本文标题:ubuntu下php7+nginx+swoole+yaf

          本文链接:https://www.haomeiwen.com/subject/jvgydttx.html