#查找php已安装版本
yum list installed | grep php
#清除旧版
yum remove -y *php*-runtime.x86_64...
#下载安装源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
##更多源
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
#查看安装包
yum --enablerepo=remi install -y php74-php
yum --enablerepo=remi install -y php74-php-fpm
yum --enablerepo=remi install -y php74-php-mysqlnd
#修改配置,增大内存限制
vim /etc/opt/remi/php74/php.ini
memory_limit = 512M
#修改apache为nginx
vim /etc/opt/remi/php74/php-fpm.d/www.conf
user = nginx
group = nginx
#运行并查看版本
php74 -v
#重启命令php-fpm
systemctl restart php74-php-fpm
#添加自动启动
systemctl enable php74-php-fpm
#查看php7.4的安装路径
whereis php
#链接php文件
ln -s /opt/remi/php74/root/usr/bin/php /usr/bin/php
#生成测试文件
echo "<?php phpinfo(); ?>" >> /usr/share/nginx/html/phpinfo/index.php
暂无评论