centos7.6编译安装php7.4.1

wget https://www.php.net/distributions/php-7.4.1.tar.gz 下载PHP7.4.1到centos

tar -zxvf php-7.4.1 解压

cd php-7.4.1 切换到php7.4.1目录

安装php7.4.1依赖包

yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel

默认安装输入./configure即可,不推荐这样,可以按照下方自定义路径安装

./configure –prefix=/usr/local/php –disable-fileinfo –enable-fpm –with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d –with-openssl –with-zlib –with-curl –enable-ftp –with-gd –with-xmlrpc –with-jpeg-dir –with-png-dir –with-freetype-dir –enable-gd-native-ttf –enable-mbstring –with-mcrypt=/usr/local/libmcrypt –enable-zip –enable-mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-mysql-sock=/var/lib/mysql/mysql.sock –without-pear –enable-bcmath

提示No package ‘sqlite3’ found 请执行下方命令

yum install sqlite-devel 继续输入编译条件回车

提示No package ‘oniguruma’ found 输入下方命令安装

yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-6.7.0-1.el7.x86_64.rpm
yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-devel-6.7.0-1.el7.x86_64.rpm

继续输入编译条件回车

编译条件设置完毕,输入make && make install 安装

创建php运行用户组及用户

groupadd www-data

useradd -M -g www-data -s /sbin/nologin www-data

然后进入目录cp文件

cd /usr/local/php/etc

cp php-fpm.conf.default php-fpm.conf

cd php-fpm.d

cp www.conf.default www.conf

vi www.conf

搜索“user”设置运行账号:

user=www-data

group=www-data

vi /etc/systemd/system/php-fpm.service创建文件并添加一下内容,把php加入系统服务

[Unit]

Description=php-fpm

After=network.target

[Service]

Type=forking

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

PrivateTmp=True

[Install]

WantedBy=multi-user.target

设置php-fpm开机自启动

systemctl enable php-fpm.service

启动php-fpm

systemctl start php-fpm.service

给TA买糖
共{{data.count}}人
人已赞赏
PHP笔记

PHP实现网站访客来访显示访客IP&浏览器&操作系统

2019-6-4 1:22:52

PHP笔记

php面向对象之引用传递赋值

2020-5-17 19:03:48

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索