%20%E4%B8%AD%E7%9A%84%20Ubuntu%20%E4%B8%AD%E5%B0%86%20PHP%207.2%20%E5%8D%87%E7%BA%A7%E5%88%B0%207.4.png)
我需要在 Windows 10 中的 WSL 下的 Ubuntu 中将默认的 PHP 版本 7.2 升级到 7.4。我该怎么做?
答案1
经过两天的研究。我将我的 php 版本从 7.2 升级到了 7.4。步骤如下:
- 更新windows10中ubuntu的版本(Linux子系统)。
- 将行添加
deb http://hu.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
到文件/etc/apt/sources.list
sudo apt update && sudo apt dist-upgrade
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.4
php -v
7.安装php7.4模块(扩展)
sudo apt-get install libapache2-mod-php7.4 php7.4-fpm libapache2-mod-fcgid php7.4-curl php7.4-dev php7.4-gd php7.4-mbstring php7.4-zip php7.4-mysql php7.4-xml
sudo a2enmod php7.4
service apache2 restart