跳至内容

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 个月前90 查看次数

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

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。