官方说明: https://www.alibabacloud.com/help/zh/elastic-compute-service/latest/manually-deploy-an-lnmp-environment-on-an-ecs-instance-that-runs-alibaba-cloud-linux-2
官方安装的是PHP7.0我这里说下怎么安装PHP8以及如何安装PHP扩展
1. 添加yum remi源 (这个是专门为php做的源, 可以查看你的操作系统适合哪个版本的源以及使用方法: Remi's RPM repository (remirepo.net) )
1 yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm 2 3 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2. 搜索PHP可用版本
yum search php //注意不要用yum list php 不然只有php5.4
3. 安装php82
yum install -y php82
4. 查询PHP版本
1 php -v 2 3 PHP 8.2.3 (cli) (built: Feb 14 2023 01:06:39) (NTS gcc x86_64) 4 Copyright (c) The PHP Group 5 Zend Engine v4.2.3, Copyright (c) Zend Technologies
5. 查询PHP默认安装的扩展
php -m
6. 安装PHP mbstring扩展
1 // 搜索 mbstring 2 yum search php | grep php82 | grep mbstring 3 4 //结果: 5 php82-php-mbstring.x86_64 : A module for PHP applications which need multi-byte 6 7 //安装 8 yum install -y php82-php-mbstring 9 10 //检查是否安装了 11 php -m | grep mbstring
7. 安装其他扩展
1 yum install -y php82-php-fpm.x86_64 //配置文件在: /etc/opt/remi/php82/php-fpm.d/www.conf 可以更改 user,group 等指令. 2 3 yum install -y install php82-php-mysqlnd.x86_64
8. 启动fpm
1 systemctl start php82-php-fpm 2 3 开启启动: 4 systemctl enable php82-php-fpm标签:php,php82,yum,install,linux,PHP,安装,cloud From: https://www.cnblogs.com/kvluu/p/18056729