0
点赞
收藏
分享

微信扫一扫

安装PHP,版本7.3.10

你带来了我的快乐 2022-03-12 阅读 105

一、进入官网

网址:https://www.php.net

1.查看安装包链接

选择上方“download”, Current Stable PHP 7.3.10,php-7.3.10.tar.gz

https://www.php.net/distributions/php-7.3.10.tar.gz

https://www.php.net/distributions/php-8.0.9.tar.gz

2.查看官方用户手册

选项上方“Documentation”,打开的新网页左侧“View Online”中,选择Chinese (Simplified),官方中文手册网址:https://www.php.net/manual/zh/。

(1)查阅“使用 PHP-FPM 为 Nginx 1.4.x HTTP 服务器安装和配置 PHP ”的说明

PHP 手册 ->安装与配置 -> Unix 系统下的安装-> Unix 系统下的 Nginx 1.4.x

(2)查阅“FPM(FastCGI 进程管理器)”的说明

PHP 手册-> 安装与配置 ->FastCGI 进程管理器(FPM)->安装

(3) 以启用 mysqli 扩展的方式编译 PHP

PHP 手册-> 函数参考-> 数据库扩展-> 针对各数据库系统对应的扩展-> MySQL-> Mysqli-> 安装/配置

PHP7以后,支持mysqli和PDO_MySQL两种mysql的扩展模式

二、安装

1.下载PHP官方包

# wget https://www.php.net/distributions/php-7.3.11.tar.gz

2.解压软件包

# tar -xzxvf php-8.0.9.tar.gz

3.设置编译需要加载的模块

# cd php-8.0.9

# yum install gcc

# yum install libxml2-devel

# ./configure --enable-fpm --with-mysqli --enable-mbstring --with-zlib --with-openssl

./configure SQLITE_CFLAGS="/usr/local/include" SQLITE_LIBS="/usr/local/lib" --enable-fpm --with-mysqli  --enable-mbstring --with-zlib

(2)编译7.4

# yum install oniguruma

# yum install oniguruma-devel

# yum install gcc-c++

4.编译

# make clean

# make

# make install

若取消编译:

# make clean         //只清除之前编译的可执行文件及配置文件。

# make distclean           //清除所有生成的文件。

若卸载软件:

# make uninstall              //卸载

CFLAGS

指定头文件(.h文件)的路径,一般是用来安装了库包后,安装目录下会有两个文件(include和lib),再来安装应用程序包时,就需要指定(include)头文件路径

# ./configure  CFLAGS=”-I/usr/include”        //-I: include

LDFLAGS

指定库文件的路径,一般是用来安装了库包后, 安装目录下会有两个文件(include和lib),再来安装应用程序包时,就需要指定(lib)库文件路径

# ./configure  LDFLAGS=”-L/usr/include”       //-L: lib

https://www.linuxidc.com/Linux/2019-11/161300.htm

5.创建配置文件,并将其复制到正确的位置。

# cp php.ini-development /usr/local/lib/php.ini

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

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

三、配置php-fpm服务到systemctl

1.打开php-fpm.conf

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

找到以下内容并修改

; Pid file

; Note: the default prefix is /usr/local/php/var

; Default Value: none

pid = /var/run/php-fpm.pid

include=/usr/local/etc/php-fpm.d/*.conf

;/usr/local/etc/php-fpm.d

2.新建php-fpm服务文件

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

[Unit]

Description=The PHP FastCGI Process Manager

After=syslog.target network.target

[Service]

Type=forking

PIDFile=/var/run/php-fpm.pid

ExecStart= /usr/local/sbin/php-fpm

ExecReload=/bin/kill -USR2 $MAINPID

PrivateTmp=true

[Install]

WantedBy=multi-user.target

3.重新加载systemctll配置:

# systemctl daemon-reload

4.状态管理

systemctl start php-fpm.service

systemctl status php-fpm.service

systemctl stop php-fpm.service

systemctl restart php-fpm.service

systemctl enable php-fpm.service

systemctl didable php-fpm.service

举报

相关推荐

0 条评论