跳至內容

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 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。