If you’re encountering the “The uploaded file exceeds the upload_max_filesize directive in php.ini” error while trying to upload and install a new WordPress theme on your gcloud-hosted site, don’t worry – there are several steps you can take to resolve this issue.
1. Check php.ini Configuration:
Start by confirming your php.ini settings. Although you’ve set the upload_max_filesize
to 30M, it seems that the changes are not taking effect. Ensure that you’re editing the correct php.ini file. You might want to restart your server after making changes to ensure they are applied.
2. .htaccess File:
While editing .htaccess is a common solution, it seems like you couldn’t find the file in your WordPress root directory. Create a new .htaccess file if it doesn’t exist and add the following code:
php_value upload_max_filesize 30M
php_value post_max_size 30M
php_value memory_limit 512M
php_value max_input_time 180
php_value max_execution_time 180
Make sure to save the changes and check if the issue persists.
3. wp-config.php Edits:
Your attempts to modify wp-config.php are on the right track. However, the syntax might be causing the issue. Update the code as follows:
define('WP_MEMORY_LIMIT', '512M');
Place this line just before the line that says /* That's all, stop editing! Happy blogging. */
. Save the changes and check if the problem is resolved.
4. Verify Media Upload Settings:
Even after making changes, if you still see the “Maximum upload file size: 2 MB” message in WordPress, navigate to Settings > Media
and check the “Max upload file size” setting. Adjust it to your desired value and save changes.
5. Plugin Interference:
Deactivate all plugins temporarily to rule out any conflicts. Sometimes, a plugin may impose its own upload limits. If the issue resolves after deactivating plugins, reactivate them one by one to identify the culprit.
6. Contact Hosting Support:
If none of the above solutions work, reach out to your hosting provider’s support. They may have server-level restrictions that need adjustment. Provide them with the details of your php.ini, .htaccess, and wp-config.php changes for assistance.
By following these steps, you should be able to resolve the upload_max_filesize issue and successfully install your WordPress theme. If the problem persists, it’s always a good idea to consult your hosting provider or the WordPress support community for additional guidance.