WordPress PHP Fatal error: Maximum execution time of 30 seconds exceeded

Error:
[Tue Oct 12 05:57:03.088314 2021] [php7:error] [pid 167] [client 172.16.90.64:39776] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /bitnami/wordpress/wp-content/plugins/nextgen-gallery/vendor/imagely/pope-framework/lib/class.extensibleobject.php on line 0, referer: https://dragoncoin.com/wp-admin/admin.php?page=ngg_addgallery
Resolution:

Option A: Edit php.ini

// Case: Kubernetes Pod / Docker Container
containerName=sexcenter-wordpress-6f59c9fbff-5b99h
kubectl exec --stdin --tty $containerName -- /bin/bash

// Check execution time
grep max_execution_time /opt/bitnami/php/etc/php.ini

// Change execution time duration to 1 hour
sed -i '/max_execution_time/c\max_execution_time = 3600' /opt/bitnami/php/etc/php.ini

// Check memory limit
grep memory_limit /opt/bitnami/php/etc/php.ini

// Set memory limit to 20GB
sed -i '/memory_limit/c\memory_limit = 20G' /opt/bitnami/php/etc/php.ini

// Change execution time duration and memory to unlimited (for testing purposes)
sed -i '/max_execution_time/c\max_execution_time = 999999' /opt/bitnami/php/etc/php.ini
sed -i '/memory_limit/c\memory_limit = -1' /opt/bitnami/php/etc/php.ini

// Restart apache
apachectl restart

Option B: Edit wp-config.php

// Set execution time to 24 hours
ini_set('max_execution_time', '5184000');
set_time_limit(5184000);

Option C: Edit .htaccess

php_value max_execution_time 120

Leave a Reply

Your email address will not be published. Required fields are marked *