PHP7.2 、git、swoole安裝

1、安裝phpphp

1.安裝gccmysql

yum -y install gcc gcc-c++

2.安裝一些庫c++

1 yum -y install php-mcrypt libmcrypt-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel 
libpng-devel freetype-devel libmcrypt-devel

三、下載phpgit

http://cn2.php.net/distributions/php-7.2.4.tar.gz

四、配置參數sql

./configure --prefix=/usr/local/php7 \
--with-config-file-path=/usr/local/php7/etc \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/tmp/mysql.sock \
--enable-mysqlnd \
--with-gd \
--with-iconv \
--with-zlib \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--enable-ftp \
--with-openssl \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--with-gettext \
--with-curl \
--with-jpeg-dir \
--with-freetype-dir

五、編譯vim

make
mkae install

六、配置phpswoole

cp php.ini-development /usr/local/php7/etc/php.ini

七、加入php7

vim /usr/local/php7/etc/php.ini
zend_extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/opcache.so

複製php-fpm.confcurl

cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf

編輯php-fpm.conf,把pid 改爲 /run/php-fpm.pidsocket

vim /usr/local/php7/etc/php-fpm.conf
pid = /run/php-fpm.pid

編輯php-fpm配置www.conf會加載在php-fpm.conf

cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf

加php-fpm管理器到systemctl中

vim /usr/lib/systemd/system/php-fpm.service

按i寫入如下內容

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/run/php-fpm.pid
ExecStart=/usr/local/php7/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php7/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID

[Install]
WantedBy=multi-user.target

啓動php-fpm

systemctl start php-fpm.service

添加到開機啓動

systemctl enable php-fpm.service

下機爲systemctl指令
systemctl enable *.service #開機運行服務
systemctl disable *.service #取消開機運行
systemctl start *.service #啓動服務
systemctl stop *.service #中止服務
systemctl restart *.service #重啓服務
systemctl reload *.service #從新加載服務配置文件
systemctl status *.service #查詢服務運行狀態
systemctl --failed #顯示啓動失敗的服務

 

修改 php.ini 文件 設置 expose_php = Off
vim /usr/local/php7/etc/php.ini
找到 expose_php = On
改成 expose_php = Off

2、安裝git

1.安裝依賴

yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker autoconf

二、下載

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz

三、解壓

tar zxvf git-2.9.5.tar.gz 

四、配置參數

cd git-2.9.5/
./configure prefix=/usr/local/git/

五、編譯安裝

make
make install

六、編輯profile文件,並在最後一行添加export PATH=$PATH:/usr/local/git/bin

vi /etc/profile
export PATH=$PATH:/usr/local/git/bin

七、刷新文件

source /etc/profile

3、swoole安裝

一、下載swoole

git clone https://gitee.com/swoole/swoole.git

二、擴展模塊

/usr/local/php7/bin/phpize

三、配置參數

./configure --with-php-config=/usr/local/php7/bin/php-config

四、編譯安裝

make
make install

五、編輯php.ini添加swoole(大約在900行左右)

vi php.ini
extension=swoole

六、重啓 php

systemctl restart php-fpm.service

七、查看是否添加swoole模塊

php -m

八、測試

cd /usr/local/src/swoole/examples/server
php echo.php
netstat -anp|grep 9501
相關文章
相關標籤/搜索