鲲鹏云麒麟V10操作系统安装PHP7.0.2



下载
# wget  http://php.net/get/php-7.0.2.tar.gz/from/a/mirror

# tar zxvf php-7.0.2.tar.gz
# cd php-7.0.2


配置
./configure --prefix=/usr/local/php --with-curl  --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip

这是执行报错,openssl版本的问题吧,先把这个配置删除,后续再处理

--with-openssl报错,先删除

./configure --prefix=/usr/local/php --with-curl  --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip


缺失的文件

# yum -y install curl-devel
# yum -y install libxslt-devel

编译安装

make &&  make install


复制配置文件
cp php.ini-development /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm


配置环境变量


echo "export PATH=$PATH:/usr/local/php/bin" >> /etc/profile


启动
/etc/init.d/php-fpm


查看端口占用
 lsof -i :9000
重启PHP-FPM服务

用PS aux|grep php 查看进程,然后kill进程,再次启动


或直接用 kill -USR2 进程号 


------------------添加到systemctl服务里,设置开机启动--------------

以下是CENTOS系统的设置,在麒麟V10系统里面测试也可通用

1,添加服务,新建文件

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

内容如下

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

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

[Install]
WantedBy=multi-user.target


2,启动服务 

systemctl start php-fpm.service

3.添加到开机启动

systemctl enable php-fpm.service

检测 会显示 enable就oK

systemctl is-enabled  php-fpm.service

4,SYSTEMCTL相关命令

systemctl enable *.service #开机运行服务
systemctl disable *.service #取消开机运行
systemctl start *.service #启动服务
systemctl stop *.service #停止服务
systemctl restart *.service #重启服务
systemctl reload *.service #重新加载服务配置文件
systemctl status *.service #查询服务运行状态
systemctl --failed #显示启动失败的服务


添加回复:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。