Want more timely Centmin Mod News Updates?
Become a Member

Beta Branch add tools/php-memory-limit-summary.sh & tools/php-memory-test.php in 140.00beta01

Discussion in 'Centmin Mod Github Commits' started by eva2000, Jul 25, 2024.

  1. eva2000

    eva2000 Administrator Staff Member

    53,223
    12,116
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,654
    Local Time:
    1:24 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    add tools/php-memory-limit-summary.sh & tools/php-memory-test.php in 140.00beta01

    - add tools/php-memory-limit-summary.sh tool to summarize the /var/log/php-fpm/www-php.error.log php error log memory_limit reached php files and summarizes the past 24hrs of php error log entries and the script run output is saved to /var/log/php-fpm/php_memory_limit_summary.log
    - add tools/php-memory-test.php tool to help with testing tools/php-memory-limit-summary.sh tool by artifically triggering memory_limit exhaustion. Copy the file to your web site's Nginx web root public directory with nginx user/group permissions and edit default memory limit of 1024M to desired value and run the php script in web browser to trigger any memory_limit exhaustion as defined by your /etc/centminmod/php.d/a_customphp.ini settings file's memory_limit value

    below example shows 2 test files /home/nginx/domains/domain.com/public/php-memory-test.php and /home/nginx/domains/domain.com/public/php-memory-test2.php with set 1024M and 655M limits and summary script reporting on a server that has PHP-FPM memory_limit = 640M set in /etc/centminmod/php.d/a_customphp.ini.

    If you want to override default /etc/centminmod/php.d/a_customphp.ini set defaults, create a file that is alphanumericlaly ordered after /etc/centminmod/php.d/a_customphp.ini with setting override i.e. create /etc/centminmod/php.d/z_customphp.ini and set memory_limit = 1280M and restart php-fpm service.


    Centmin Mod dynamically sets memory_limit in /etc/centminmod/php.d/a_customphp.ini based on detected memory available on the server at initial Centmin Mod install or PHP upgrade/downgrade/recompiles via centmin.sh menu option 5

    Code (Text):
    /usr/local/src/centminmod/tools/php-memory-limit-summary.sh
    Summary for the last 24 hours:
    -----------------------------------
    File: /home/nginx/domains/domain.com/public/php-memory-test2.php
      Count: 2
      Exhausted Memory - Min: 655.00 MB, Max: 655.00 MB, Avg: 655.00 MB
      Tried to Allocate - Min: 1.00 MB, Max: 1.00 MB, Avg: 1.00 MB
    
    File: /home/nginx/domains/domain.com/public/php-memory-test.php
      Count: 3
      Exhausted Memory - Min: 1.00 GB, Max: 1.00 GB, Avg: 1.00 GB
      Tried to Allocate - Min: 1.00 MB, Max: 1.00 MB, Avg: 1.00 MB


    Continue reading...

    140.00beta01 branch