If you’re running a WordPress site on a local WAMP server, you might encounter an error when uploading large files. This happens because the default upload_max_filesize is often set to 2MB. This guide will help you increase the file upload size limit step by step.
Step 1: Locate the php.ini
File
The php.ini
file contains settings for PHP, including file upload limits, memory usage, and execution time. WAMP has multiple php.ini
files, so it’s crucial to edit the correct one.
- Open WAMP and click the WAMP icon in the system tray.
- Navigate to PHP > php.ini to open the configuration file. Alternatively, locate the file manually:
C:\wamp\bin\php\php{version}\php.ini
- Verify the correct file by creating a
phpinfo.php
file with this code:
<?php phpinfo(); ?>
Open this file in your browser and check the Loaded Configuration File path.
Step 2: Update PHP Settings
Edit the php.ini
file and update these settings:
upload_max_filesize = 64M post_max_size = 128M memory_limit = 256M max_execution_time = 300 max_input_time = 300
Save the file and close it.
Step 3: Restart WAMP Services
After editing the php.ini
file, restart WAMP to apply the changes:
- Click the WAMP icon in the system tray.
- Select Restart All Services.
Step 4: Update .htaccess
(Optional)
If WordPress or Apache settings override your changes, update the .htaccess
file in your project folder. Add this code:
# Custom PHP settings for file uploads <IfModule mod_php.c> php_value upload_max_filesize 64M php_value post_max_size 128M php_value memory_limit 256M php_value max_execution_time 300 php_value max_input_time 300 </IfModule>
Ensure this is placed outside the # BEGIN WordPress
and # END WordPress
markers.
Step 5: Verify Changes
Refresh your phpinfo.php
file and look for the updated values for upload_max_filesize and post_max_size.
Troubleshooting
- Changes Not Reflecting: Ensure you edited the correct
php.ini
file and restarted WAMP. - Conflicts with
.htaccess
: Check for other overrides in the file. - Multiple PHP Versions: Ensure you updated the
php.ini
for the active PHP version.
Conclusion
By following these steps, you can increase the file upload limit in WAMP, allowing your WordPress site to handle larger uploads without errors. If you still face issues, double-check your configurations or let us know for further help.
0 Comments