PHP fatal error – max execution time exceeded

Home Forums BulletProof Security Pro PHP fatal error – max execution time exceeded

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #39419
    flumm
    Participant

    In my PHP error log I see several entries like this:

    [13-Oct-2020 03:50:48 UTC] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /home/httpd/vhosts/xxx.xx/httpdocs/wp-content/plugins/bulletproof-security/includes/firewall-autopilot.php on line 980

    Extract from this file:

    974 foreach ( $bps_pfw_whitelist_filter as $Key => $Value ) {
    975 
    976   $Value_rule = preg_replace( '/\//', "^", $Value, 1 );
    977   $whiteList[] = 'RewriteRule ' . $Value_rule . ' - [L]' . "\n";
    978   $uniqueRules = array_unique($whiteList);
    979
    980   foreach ( $uniqueRules as $uniqueRule ) {
    981     if ( $uniqueRule != '' ) {
    982       file_put_contents($pluginsHtaccessMasterTXT, $uniqueRules);
    983     }			
    984   }
    985 }
    

    Pre-Installation Wizard (6.68 seconds) & Setup Wizard (153.65 seconds) run without problems but also take more than 120 seconds. Are this normal values for a small website or is my server too slow?

    Should I extend the max execution time from its current recommended setting 120 seconds, and to what value, if possible, or is this a different issue?

    #39420
    AITpro Admin
    Keymaster

    120 seconds (2 minutes) is an extremely long time in “code processing time”.  The Setup Wizard completion time on average is between 10 seconds to 30 seconds.  The Plugin Firewall AutoPilot code should only take milliseconds to process.  So something is not right somewhere.  Increasing the max execution time limit is the wrong approach.  120 seconds is more than enough time for any/all scripts to complete processing.  In this older forum topic that you posted > https://forum.ait-pro.com/forums/topic/rich-snippets-io-blocked/  you increased the max execution time from 30 seconds to 120 seconds to “fix” another issue.  At this point you need to figure out where the slowness/latency is occurring.  What PHP server version are you running?  What type of hosting do you have?  Do you have any plugins or anything else that would affect your WordPress Dashboard backend area? Do you have WordPress or other Debugging turned On?

    Also take a look at your server logs to see if there are other errors occurring that might indicate a root cause of the problem.

    #39425
    flumm
    Participant

    Thanks. I am using PHP 7.4.11 and using Webhosting on a server shared with many others. My hoster provides plesk management platform. My <span class=”page-content-header__title”>wp-config.php shows
    </span>

    define('WP_DEBUG', false);

    Some weeks ago I installed and started using Elementor and Essential Addons for Elementor Pro. Not sure when exactly I did that and when the issue in the logs started. This is what I see in other logs on the server:

    WordPress error log one second before php error log:

    [Tue Oct 13 05:50:47.887883 2020] [fcgid:warn] [pid 3197] [client x.x.x.x:nnnnn] mod_fcgid: read data timeout in 120 seconds, referer: https://www.xxx.xx/wp-cron.php?doing_wp_cron=1602560927.6977999210357666015625
    [Tue Oct 13 05:50:47.887927 2020] [core:error] [pid 3197] [client x.x.x.x:nnnnn] End of script output before headers: wp-cron.php, referer: https://www.xxx.xx/wp-cron.php?doing_wp_cron=1602560927.6977999210357666015625

    access log

    x.x.x.x - - [13/Oct/2020:05:50:47 +0200] "POST /wp-admin/admin-ajax.php?_fs_blog_admin=true HTTP/1.0" 200 697 "https://www.xxx.xx/wp-admin/plugins.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:81.0) Gecko/20100101 Firefox/81.0"
    x.x.x.x - - [13/Oct/2020:05:50:49 +0200] "POST /wp-cron.php?doing_wp_cron=1602561049.7302289009094238281250 HTTP/1.0" 200 316 "https://www.xxx.xx/wp-cron.php?doing_wp_cron=1602561049.7302289009094238281250" "WordPress/5.5.1; https://www.xxx.xx“
    #39426
    AITpro Admin
    Keymaster

    I guess the next thing to try is to do standard WP troubleshooting steps. ie deactivate all of your other plugins and test running the Pre-Installation Wizard and Setup Wizard and also check for any issues/problems with the Plugin Firewall AutoPilot Mode Cron.  If you notice a difference in Setup Wizard run performance then activate your plugins one by one and retest to isolate which plugin is causing the performance problems.

    Are you doing anything with Crons on your site?  ie disabling WordPress standard Crons and using a Direct Cron?

    Go to the BPS Pro > Logs & Info > System Info page > click the Get Plugins List button > post the list of plugins that you have installed on your site.

    #39429
    flumm
    Participant

    I am not doing anything special with Crons, just WordPress standard Crons. When I copy the WordPress installation via WP All-in-one migration plugin into a local VM with i7 and 2 assigned vCPUs, the Setup Wizard finishes in only 17 seconds, only 2 virtual cores and 9 times faster, but nothing is shared with other users. This is my list of plugins on my production installation. I will do the testing on my local VM/copy first, though:

    Addendio PLUS 1.1.1 - Deactivated: addendio-plus/addendio-plus.php
    Advanced CF7 DB 1.8.1 - Activated: advanced-cf7-db/advanced-cf7-db.php
    All-in-One WP Migration 7.28 - Activated: all-in-one-wp-migration/all-in-one-wp-migration.php
    All-in-One WP Migration OneDrive Extension 1.47 - Activated: all-in-one-wp-migration-onedrive-extension/all-in-one-wp-migration-onedrive-extension.php
    Antispam Bee 2.9.2 - Activated: antispam-bee/antispam_bee.php
    Anywhere Elementor 1.2.2 - Deactivated: anywhere-elementor/anywhere-elementor.php
    Autoptimize 2.7.8 - Deactivated: autoptimize/autoptimize.php
    BulletProof Security Pro 14.8 - Activated: bulletproof-security/bulletproof-security.php
    Classic Editor 1.6 - Deactivated: classic-editor/classic-editor.php
    Code Snippets 2.14.0 - Activated: code-snippets/code-snippets.php
    Contact Form 7 5.0.5 - Activated: contact-form-7/wp-contact-form-7.php
    Contact Form CFDB7 1.2.5.3 - Activated: contact-form-cfdb7/contact-form-cfdb-7.php
    Elementor 3.0.11 - Activated: elementor/elementor.php
    Essential Addons for Elementor 4.2.4 - Activated: essential-addons-for-elementor-lite/essential_adons_elementor.php
    Essential Addons for Elementor - Pro 4.1.6 - Activated: essential-addons-elementor/essential_adons_elementor.php
    Final Tiles Grid Gallery - Image Gallery 3.4.20 - Deactivated: final-tiles-grid-gallery-lite/FinalTilesGalleryLite.php
    Final Tiles Grid Gallery - Image Gallery (Premium) 3.4.20 - Activated: final-tiles-grid-gallery-lite-premium/FinalTilesGalleryLite.php
    GA Google Analytics 20200815 - Activated: ga-google-analytics/ga-google-analytics.php
    Google Analytics Dashboard for WP (GADWP) 6.2.2 - Deactivated: google-analytics-dashboard-for-wp/gadwp.php
    GP Premium 1.12.2 - Activated: gp-premium/gp-premium.php
    H5P 1.15.0 - Activated: h5p/h5p.php
    If Menu - Visibility control for menu items 0.16.1 - Deactivated: if-menu/if-menu.php
    Lingotek Translation 1.4.7 - Activated: lingotek-translation/lingotek.php
    Members 3.1.3 - Activated: members/members.php
    PDF Embedder 4.6 - Activated: pdf-embedder/pdf_embedder.php
    PHP Compatibility Checker 1.5.0 - Deactivated: php-compatibility-checker/wpengine-phpcompat.php
    Polylang 2.8.2 - Activated: polylang/polylang.php
    Really Simple CAPTCHA 2.0.2 - Activated: really-simple-captcha/really-simple-captcha.php
    Recent Posts Widget With Thumbnails 6.9.0 - Activated: recent-posts-widget-with-thumbnails/recent-posts-widget-with-thumbnails.php
    Redirection 4.8 - Activated: redirection/redirection.php
    Relevanssi 4.8.3 - Activated: relevanssi/relevanssi.php
    snip - The Rich Snippets & Structured Data Plugin 2.19.9 - Activated: rich-snippets-wordpress-plugin/rich-snippets-wordpress-plugin.php
    TablePress 1.12 - Deactivated: tablepress/tablepress.php
    The Events Calendar 5.2.0 - Activated: the-events-calendar/the-events-calendar.php
    The Events Calendar JSON+LD Deactivation 0.1.0 - Activated: the-events-calendar-json-deactivation.php
    Theme My Login 7.1.1 - Deactivated: theme-my-login/theme-my-login.php
    Ultimate Addons for Gutenberg 1.17.0 - Activated: ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php
    Usercentrics CMP 1.0.6 - Deactivated: usercentrics-consent-management-platform/usercentrics.php
    WP-Sweep 1.1.3 - Activated: wp-sweep/wp-sweep.php
    WP Fastest Cache 0.9.1.1 - Deactivated: wp-fastest-cache/wpFastestCache.php
    Yoast SEO 15.0 - Activated: wordpress-seo/wp-seo.php
    
    Must-Use Plugins:
    BPS Pro MU Tools 12.0 - Installed: bps-pro-mu-tools.php
    #39430
    AITpro Admin
    Keymaster

    The only plugin that stands out as a possible cause of performance problems would be the Autoptimize plugin (and yes I get the irony). 😉 I have fiddled with Autoptimize and there is potential to cause lots of problems depending on which option settings you choose.

    #39431
    flumm
    Participant

    I deactivated all plugins on my test VM except BPS Pro, and the Setup Wizard still needed between 15 and 17 seconds. This is nearly the same time as with all plugins activated, and as stated, it is 9 times faster than on my hosted WordPress environment in production. Is 17 seconds a standard value for a local VM with 2 vCPUs, or rephrased, is my hosting in production too slow?

    #39432
    AITpro Admin
    Keymaster

    17 seconds for the Setup Wizard to complete is in the average range and what I would consider to be normal. It’s possible that your host server has been “oversold” meaning there are too many websites on your particular host server or some websites that are on your same host server are using up all the server’s resources. That is something that you would have to have your web host check.  The only other thing I can think of is increasing your PHP memory limit, but if that was a problem then you would be seeing a PHP out of memory error.

    And host servers have intermittent problems from time to time. So maybe this problem will fix itself in a day or so. Asking your web host if there are global outages or server problems will always get you the same answer – “There are no server problems”. LOL

    One other quick and simple thing to try is to switch your PHP server version to a different PHP server/version. The current PHP server that you are using could have some problems.

    #39439
    flumm
    Participant

    I opened a ticket at my provider and ran the Pre-Installation Wizard followed by Setup Wizard afterwards several times in a row in production (with all plugins activated, and I didn’t receive an answer from support yet):

    Setup Wizard Completion Time (earlier today 153.65 seconds):

    • 22.45 Seconds
    • 52.56 Seconds
    • 20.64 Seconds
    • 43.46 Seconds
    • 25.6 Seconds
    • 49.5 Seconds

    Anything between 20.6 and 153.7 seconds, what a large statistical dispersion.. So it seems 20 seconds are possible, but under heavy load it turns into 153++ seconds.

    #39440
    AITpro Admin
    Keymaster

    Yep, those completion times are all over the place, which definitely looks like an intermittent server-side load/resource issue. The normal Setup Wizard completion time is actually between 10 seconds and 30 seconds (not 60 seconds).  I corrected that in one of my earlier forum replies.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.