环境
编译环境
安装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
- ./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config --enable-swoole-debug --enable-sockets --enable-http2 --enable-async-redis --enable-jemalloc --enable-openssl --with-openssl=/usr/local/openssl
- ./configure --with-PHP-config=/usr/local/PHP/bin/PHP-config --enable-sockets --enable-http2 --enable-async-redis --enable-jemalloc --enable-openssl --with-openssl=/usr/local/openssl
- 6. sudo make && make install
- 5. sudo vim /etc/PHP/PHP.ini 最后添加
- extension=swoole.so
- PHP.ini开启 proc_open
- 配置PHP.ini
- 编译安装成功后,修改PHP.ini加入
- extension=swoole.so
- 通过PHP -m或PHPinfo()来查看是否成功加载了swoole,如果没有可能是PHP.ini的路径不对,可以使用PHP -i |grep PHP.ini来定位到PHP.ini的绝对路径。
安装 Nginx 1.10.1
- 1. wget http://Nginx.org/download/Nginx-1.10.1.tar.gz
- 2. tar -zxvf Nginx-1.10.1.tar.gz
- 3. cd Nginx-1.10.1/
- 4 . /configure make && make install
- 5. cp /usr/local/Nginx/sbin/Nginx /usr/local/bin/Nginx
- 2. vim /etc/Nginx/sites-enabled/default
- index index.html index.htm index.PHP;
- location ~ \.PHP$ {
- try_files $uri =404;
- fastcgi_param SCRIPT_FILENAME /path$fastcgi_script_name;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.PHP;
- include fastcgi_params;
- }
- 3. sudo Nginx 启动
- sudo Nginx -s reload
配置PHP-fpm
安装MysqL 5.7.13
安装 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