スキップしてコンテンツを表示

Editing php.ini file

0

I need to edit the max_upload_size in the php.ini file but I'm getting permission denied error when uploading new file using FTP The wordpress install in on the Lightsail blueprint - not Bitnami I have located 2 php.ini files on the server /etc/php/8.2/cli/php.ini /etc/php/8.2/apache2/php.ini which one should I edit and how do I do it?

質問済み 2ヶ月前86ビュー
1回答
1
承認された回答

For a WordPress installation on Lightsail (non-Bitnami), you should edit the /etc/php/8.2/apache2/php.ini file, as this is the configuration file that Apache web server uses when serving PHP content through your WordPress site. The CLI version is used for command-line PHP scripts.

To edit this file, you'll need to use SSH to connect to your instance rather than FTP, since you need elevated permissions. Here's how:

  1. Connect to your Lightsail instance using the browser-based SSH client from the Lightsail console, or use your preferred SSH client.

  2. Create a backup of the file first:

sudo cp /etc/php/8.2/apache2/php.ini /etc/php/8.2/apache2/php.ini.backup
  1. Edit the file using a text editor like nano or vim with sudo privileges:
sudo nano /etc/php/8.2/apache2/php.ini

or

sudo vim /etc/php/8.2/apache2/php.ini
  1. Find and modify the upload_max_filesize directive (and you may also want to increase post_max_size to match or exceed this value).

  2. Save the file and exit the editor.

  3. Restart Apache to apply the changes:

sudo systemctl restart apache2

The permission denied error you're experiencing with FTP occurs because system configuration files require root privileges to modify, which FTP typically doesn't provide. Using SSH with sudo is the proper method for editing system files.
Sources
Configure WordPress with a Lightsail content delivery network - Amazon Lightsail

回答済み 2ヶ月前
エキスパート
レビュー済み 2ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

関連するコンテンツ