简体   繁体   English

PHP 使用了一个不存在的 PHP.ini 文件

[英]PHP uses a PHP.ini file that does not exist

I need to upgrade my PHP version in WordPress, but when I try, it still returns me the older version, even the folder does not exist.我需要在 WordPress 中升级我的 PHP 版本,但是当我尝试时,它仍然返回旧版本,甚至文件夹不存在。

错误的路径

服务器中的实际路径

You need to follow the below steps for updating:您需要按照以下步骤进行更新:

  1. Add PPA repository for PHP为 PHP 添加 PPA 存储库

sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php sudo apt install software-properties-common sudo add-apt-repository ppa:ondrej/php

  1. Update Ubuntu更新 Ubuntu

Open terminal and run the following commands to update Ubuntu packages.打开终端并运行以下命令来更新 Ubuntu 包。

sudo apt-get update

  1. Install PHP (Whichever version you wanna install like 7.4 8 etc)安装 PHP (无论你想安装哪个版本,比如 7.4 8 等)

sudo apt install php7.4

Check php version

sudo php -v

  1. Install PHP Extensions (Optional)安装 PHP 扩展(可选)

PHP extensions are commonly used along with PHP. PHP 扩展通常与 PHP 一起使用。 Install them with the following command.使用以下命令安装它们。

sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y

  1. Enable PHP 7.4 for Apache为 Apache 启用 PHP 7.4

Next you need to disable your old PHP (say 7.0) and enable new PHP 7.4.接下来,您需要禁用旧的 PHP(比如 7.0)并启用新的 PHP 7.4。

sudo a2dismod php7.0 sudo a2enmod php7.4 sudo a2dismod php7.0 sudo a2enmod php7.4

  1. Restart Apache Server重启Apache服务器

Restart Apache web server to apply changes重启 Apache web 服务器以应用更改

sudo service apache2 restart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM