AWS PHP Upload Limit
February 18, 2025 ยท AI Conversations
### 1. **Update PHP Configuration**
Since you're using Apache on your EC2 instance, you need to update the `php.ini` file.
#### Locate `php.ini`
Run the following command to find the location of your `php.ini` file:
php --ini | grep "Loaded Configuration File"
It will return a path like:
Loaded Configuration File: /etc/php/8.3/apache2/php.ini
Edit `php.ini`:
sudo nano /etc/php/8.3/apache2/php.ini
Find and update these values:
upload_max_filesize = 64M
post_max_size = 128M
max_execution_time = 300
max_input_time = 300
memory_limit = 256M
Save and exit (Press `CTRL + X`, then `Y`, then `Enter`).
### 2. **Update Apache Configuration**
Edit your Apache configuration file:
sudo nano /etc/apache2/apache2.conf
Add or update these values:
<Directory /var/www/>
php_value upload_max_filesize 64M
php_value post_max_size 128M
</Directory>
Save and exit.
### 3. **Restart Apache**
Apply the changes by restarting Apache:
sudo systemctl restart apache2
### 4. **Verify the Changes**
Create a PHP info file:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/share/phpinfo.php
Then, open `http://your-domain.com/phpinfo.php` in your browser and check the updated values.
Let me know if you need further assistance! ๐