Discover Centmin Mod today
Register Now

PHP-FPM Max execution time php-fpm and nginx

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Glock, Jan 25, 2016.

Tags:
  1. Glock

    Glock New Member

    15
    7
    3
    Oct 28, 2015
    Ratings:
    +7
    Local Time:
    10:43 AM
    Hi all,
    Hope everyone is well..

    Okay bit of a tricky one, but probably not for you guys.
    I am rebuilding my gallery thumbnails and watermarks - of which there are thousands!
    Anyway I constantly get max execution time exceeded 120 etc.

    As a result it's also affecting installing and removing things as the system is still trying to execute my call to clear caches and rebuild parts of the gallery.

    I thought okay so adjust php.ini - no go. So then I added lines to nginx config, still no joy.
    So I have removed all again and am a bit stuck, how do I extend the execution time, for the script and then put it back once I am finished?
    I found some guides online, but nothing exactly specific to this.
    Many thanks in advance all!
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,178
    6,786
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,139
    Local Time:
    7:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    • Like Like x 1
    • Winner Winner x 1
  3. Glock

    Glock New Member

    15
    7
    3
    Oct 28, 2015
    Ratings:
    +7
    Local Time:
    10:43 AM
  4. eva2000

    eva2000 Administrator Staff Member

    30,178
    6,786
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,139
    Local Time:
    7:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    centmin mod php custom max execution time is 60s anyway centminmod/phpsededit.inc at 123.08stable · centminmod/centminmod · GitHub so not sure where you get 120 limit from

    or is important from name of custom php ini file has to be after the default custom php file /etc/centminmod/php.d/a_customphp.ini https://community.centminmod.com/posts/21135/
    what's output of
    Code:
    php --ini
    ensure your custom php.ini file is named alphabetically so it lists after /etc/centminmod/php.d/a_customphp.ini

    if you still get 120s, then your web php app has it's own set limit you need to adjust
     
    • Like Like x 1
  5. Glock

    Glock New Member

    15
    7
    3
    Oct 28, 2015
    Ratings:
    +7
    Local Time:
    10:43 AM
    Okay I have redone it to the exact replica created b_customphp.ini with max_execution_time = 360 and restarted php and nginx

    ErrorException: Fatal Error: Maximum execution time of 120 seconds exceeded - library/XenGallery/Helper/Image.php:294
     
  6. Glock

    Glock New Member

    15
    7
    3
    Oct 28, 2015
    Ratings:
    +7
    Local Time:
    10:43 AM
    Code:
    Configuration File (php.ini) Path: /usr/local/lib
    Loaded Configuration File:         /usr/local/lib/php.ini
    Scan for additional .ini files in: /etc/centminmod/php.d
    Additional .ini files parsed:      /etc/centminmod/php.d/a_customphp.ini,
    /etc/centminmod/php.d/b_customphp.ini,
    /etc/centminmod/php.d/curlcainfo.ini,
    /etc/centminmod/php.d/geoip.ini,
    /etc/centminmod/php.d/igbinary.ini,
    /etc/centminmod/php.d/imagick.ini,
    /etc/centminmod/php.d/memcache.ini,
    /etc/centminmod/php.d/memcached.ini,
    /etc/centminmod/php.d/mongodb.ini,
    /etc/centminmod/php.d/redis.ini,
    /etc/centminmod/php.d/zendopcache.ini
    
    Hmm okay, I will check the others too, as I adjusted it now to 360 and still get 120.
     
  7. Glock

    Glock New Member

    15
    7
    3
    Oct 28, 2015
    Ratings:
    +7
    Local Time:
    10:43 AM
    How strange, after about another 7-8 attempts to execute this, (clearing the caches) - it's done it on its own this time.
    Thank you for the help, appreciated. The execution time is still the same, but at least this completed finally.
    Many thanks!
     
  8. eva2000

    eva2000 Administrator Staff Member

    30,178
    6,786
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,139
    Local Time:
    7:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    curious what php app is this ?
     
  9. Glock

    Glock New Member

    15
    7
    3
    Oct 28, 2015
    Ratings:
    +7
    Local Time:
    10:43 AM
    Literally, rebuilding the gallery caches for watermarks in XF. Under tools > rebuild caches > Rebuild XenForo Media Gallery Watermarks
    It went eventually but after many, many, attempts. I watched as it did almost 8k items, but when it was failing, it was always at around 5,550 -odd.
    Always the same response, max execution time succeeded.
    It's still 120 and I have no idea what is governing this now as I changed all the files that I know were mentioned in the guides, over the last few days and also following your advice. :confused:
     
  10. eva2000

    eva2000 Administrator Staff Member

    30,178
    6,786
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,139
    Local Time:
    7:43 PM
    Nginx 1.13.x
    MariaDB 5.5
    Xenforo doesn't set max_execution_time AFAIK unless the XMG does.
     
  11. RoldanLT

    RoldanLT Well-Known Member

    3,901
    949
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,298
    Local Time:
    5:43 PM
    1.11
    10.2
    On your /library/config.php, add:
    Code:
    ini_set('max_execution_time', 300);