php7.0安装了怎么启动,linux-centos7中安装php7-0.0.0用最新管理systemctl控制启动关闭...

linux之centos7中安装php7 后面有systemctl管理文件php-fpm.service

安装gcc gcc-c++ wget

安装gcc gcc-c++ wget

yum -y install gcc gcc-c++ wget

1

yum-yinstallgccgcc-c++wget

.安装一些库

安装php库

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

1

yum-yinstallphp-mcryptlibmcrypt-devellibxml2libxml2-developensslopenssl-develcurl-devellibjpeg-devellibpng-develfreetype-devellibmcrypt-devel

wget PHP7的下载地址

下载php7.0.0rc5

wget https://downloads.php.net/~ab/php-7.0.0RC5.tar.gz

1

wgethttps://downloads.php.net/~ab/php-7.0.0RC5.tar.gz

下载后解压进入目录

解压php

tar zxvf php-7.0.0RC5.tar.gz

1

tarzxvfphp-7.0.0RC5.tar.gz

进入php目录

cd php-7.0.0RC5

1

cdphp-7.0.0RC5

# 配置参数

./configure --prefix=/usr/local/php7 \

--with-config-file-path=/usr/local/php7/etc \

--with-mcrypt=/usr/include \

--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 \

--enable-gd-native-ttf \

--with-openssl \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-zip \

--enable-soap \

--with-gettext \

--with-curl \

--with-jpeg-dir \

--with-freetype-dir

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

./configure--prefix=/usr/local/php7\

--with-config-file-path=/usr/local/php7/etc\

--with-mcrypt=/usr/include\

--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\

--enable-gd-native-ttf\

--with-openssl\

--enable-pcntl\

--enable-sockets\

--with-xmlrpc\

--enable-zip\

--enable-soap\

--with-gettext\

--with-curl\

--with-jpeg-dir\

--with-freetype-dir

编译

make php编译php

make

1

make

安装

安装php

make install

1

makeinstall

复制php.ini

配置安装好的php

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

1

cpphp.ini-production/usr/local/php7/etc/php.ini

复制php-fpm.conf

复php-fpm.conf

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

1

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

复制php-fpm下的conf

复php-fpm下的conf

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

1

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

然后在php.ini中加入opcache

编辑php.ini

vim /usr/local/php7/etc/php.ini

1

vim/usr/local/php7/etc/php.ini

加入so

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

1

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

把php.ini中的这两expose_php版本号关掉

expose_php = Off

cgi.fix_pathinfo=0

1

2

expose_php=Off

cgi.fix_pathinfo=0

编辑 /php-fpm.conf

vim /usr/local/php7/etc/php-fpm.conf

1

vim/usr/local/php7/etc/php-fpm.conf

pid=/run/php-fpm.pid

然后把php-fpm加入systemd中

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

1

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

写入以下内容下面为systemctl管理php-fpm启动文件

[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

1

2

3

4

5

6

7

8

9

10

11

12

13

[Unit]

Description=ThePHPFastCGIProcessManager

After=syslog.targetnetwork.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用来管理php

systemctl start php-fpm.service

1

systemctlstartphp-fpm.service

加到开机自启动

systemctl enable php-fpm.service

1

systemctlenablephp-fpm.service

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值