- Newest
- Most votes
- Most comments
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:
-
Connect to your Lightsail instance using the browser-based SSH client from the Lightsail console, or use your preferred SSH client.
-
Create a backup of the file first:
sudo cp /etc/php/8.2/apache2/php.ini /etc/php/8.2/apache2/php.ini.backup
- 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
-
Find and modify the
upload_max_filesizedirective (and you may also want to increasepost_max_sizeto match or exceed this value). -
Save the file and exit the editor.
-
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
Relevant content
- asked 2 years ago
