Skip to content

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?

asked a month ago71 views
1 Answer
1
Accepted Answer

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

answered a month ago
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.