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