Want to subscribe to topics you're interested in?
Become a Member

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:
    11:45 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

    54,868
    12,239
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,810
    Local Time:
    9:45 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  3. Glock

    Glock New Member

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

    eva2000 Administrator Staff Member

    54,868
    12,239
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,810
    Local Time:
    9:45 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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
     
  5. Glock

    Glock New Member

    15
    7
    3
    Oct 28, 2015
    Ratings:
    +7
    Local Time:
    11:45 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:
    11:45 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:
    11:45 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

    54,868
    12,239
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,810
    Local Time:
    9:45 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    curious what php app is this ?
     
  9. Glock

    Glock New Member

    15
    7
    3
    Oct 28, 2015
    Ratings:
    +7
    Local Time:
    11:45 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

    54,868
    12,239
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,810
    Local Time:
    9:45 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Xenforo doesn't set max_execution_time AFAIK unless the XMG does.
     
  11. rdan

    rdan Well-Known Member

    5,447
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    7:45 PM
    Mainline
    10.2
    On your /library/config.php, add:
    Code:
    ini_set('max_execution_time', 300);