php7.2.4+nginx1.15.1+swoole4.0.1安装

php
1,先安装如下依赖包

$ yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

wget  http://cn2.php.net/distributions/php-7.2.4.tar.gz
tar -zxvf php-7.2.0.tar.gz
cd php-7.2.0
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pear --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib --with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl
make && make install

make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1 :
是因为服务器内存不足1G。
只需要在配置命令中添加 --disable-fileinfo即可

internal compiler error: Killed (program cc1) :
为了保护重要进程不被oom-killer掉,我们可以:echo -17 > /proc//oom_adj,-17表示禁用OOM
我们也可以对把整个系统的OOM给禁用掉:
sysctl -w vm.panic_on_oom=1 (默认为0,表示开启)
sysctl -p

sudo dd if=/dev/zero of=/swapfile bs=64M count=16
#count的大小就是增加的swap空间的大小,64M是块大小,所以空间大小是bs*count=1024MB
sudo mkswap /swapfile
#把刚才空间格式化成swap格式
sudo swapon /swapfile
#使用刚才创建的swap空间

sudo swapoff /swapfile
sudo rm /swapfile

在centos7.2当中就可以使用下面的方式进行添加
vim /etc/profile文件
pathmunge /usr/local/php/bin 配置环境变量

export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/git/bin:/usr/local/php/bin
pathmunge /usr/local/php/bin 配置环境变量

7,查看php.ini的位置
php -i | grep Configuration
若没有php.ini
cp 安装包里的php.ini 到 安装目录下ext文件夹下

nginx
wget http://nginx.org/download/nginx-1.15.1.tar.gz
tar -zxvf nginx-1.15.1
./configure //nginx默认安装位置是在/usr/local/nginx下
make && make
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
./nginx -s quit:此方式停止步骤是待nginx进程处理任务完毕进行停止。
./nginx -s stop:此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程

8,openssl 的安装
cd php7.2.4/ext/openssl
phpize
cp config0.m4 config.m4
./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config
make && make install

swoole4.0

1.安装http2

a.下载 nghttp2, 解压 sudo tar -zxvf nghttp2-1.32.0.tar.xz

b.进入目录 nghttp2-1.32.0

sudo ./configure

sudo make && make install

2.安装hiredis

a.下载hiredis  解压 sudo tar -zxvf hiredis-0.13.3.tar.gz

b.进入目录hiredis-0.13.3,执行 sudo make -j && sudo make install

wget https://pecl.php.net/get/swoole-4.0.2.tgz
进入swoole目录,执行命令 /usr/local/php/bin/phpize
./configure
–with-php-config=/usr/local/php/bin/php-config
–enable-openssl
–enable-http2
–enable-async-redis
–enable-sockets
–enable-mysqlnd

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值