Want more timely Centmin Mod News Updates?
Become a Member

PHP-FPM php_admin_value, Where can we adjust this values on CentMinMod?

Discussion in 'Centmin Mod Insights' started by RoldanLT, Jul 31, 2014.

  1. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    1:47 AM
    1.11
    10.2
  2. eva2000

    eva2000 Administrator Staff Member

    31,001
    6,920
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,426
    Local Time:
    3:47 AM
    Nginx 1.13.x
    MariaDB 5.5
    FYI, i use 256MB PHP memory limit and it can be set either in /usr/local/etc/php-fpm.conf (command shortcut = fpmconf) or via memory_limit in /usr/local/lib/php.ini (command shortcut = phpedit) :)
     
    • Like Like x 1
  3. RoldanLT

    RoldanLT Well-Known Member

    3,979
    966
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,331
    Local Time:
    1:47 AM
    1.11
    10.2
    But I don't see it on my: /usr/local/etc/php-fpm.conf
    Code:
    pid = /var/run/php-fpm/php-fpm.pid
    error_log = /var/log/php-fpm/www-error.log
    emergency_restart_threshold = 10
    emergency_restart_interval = 1m
    process_control_timeout = 10s
    ;include=/usr/local/nginx/conf/phpfpmd/*.conf
    
    [www]
    user = nginx
    group = nginx
    
    listen = 127.0.0.1:9000
    listen.allowed_clients = 127.0.0.1
    ;listen.backlog = -1
    
    ;listen = /tmp/php5-fpm.sock
    ;listen.owner = nobody
    ;listen.group = nobody
    ;listen.mode = 0666
    
    pm = ondemand
    pm.max_children = 50
    pm.start_servers = 20
    pm.min_spare_servers = 5
    pm.max_spare_servers = 35
    
    ;pm = dynamic
    ;pm.max_children = 8
    ;pm.start_servers = 4
    ;pm.min_spare_servers = 2
    ;pm.max_spare_servers = 6
    
    pm.max_requests = 10000
    
    ; PHP 5.3.9 setting
    ; The number of seconds after which an idle process will be killed.
    ; Note: Used only when pm is set to 'ondemand'
    ; Default Value: 10s
    pm.process_idle_timeout = 10s;
    
    rlimit_files = 65536
    rlimit_core = 0
    
    ; The timeout for serving a single request after which the worker process will
    ; be killed. This option should be used when the 'max_execution_time' ini option
    ; does not stop script execution for some reason. A value of '0' means 'off'.
    ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    ; Default Value: 0
    ;request_terminate_timeout = 0
    ; Default Value: 0
    ;request_slowlog_timeout = 0
    slowlog = /var/log/php-fpm/www-slow.log
    
    pm.status_path = /phpstatus
    ping.path = /phpping
    ping.response = pong
    
    ; Limits the extensions of the main script FPM will allow to parse. This can
    ; prevent configuration mistakes on the web server side. You should only limit
    ; FPM to .php extensions to prevent malicious users to use other extensions to
    ; exectute php code.
    ; Note: set an empty value to allow all extensions.
    ; Default Value: .php
    security.limit_extensions = .php .php3 .php4 .php5
    
    ; catch_workers_output = yes
    php_admin_value[error_log] = /var/log/php-fpm/www-php.error.log
     
  4. eva2000

    eva2000 Administrator Staff Member

    31,001
    6,920
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,426
    Local Time:
    3:47 AM
    Nginx 1.13.x
    MariaDB 5.5
    you have to add it yourself at end of file as Centmin Mod doesn't edit memory_limit via php-fpm.conf only by the normal php.ini file edit. That's how I do it on my forums here too :D
     
    Last edited: Jul 31, 2014
    • Like Like x 1
  5. BamaStangGuy

    BamaStangGuy Active Member

    475
    137
    43
    May 25, 2014
    Ratings:
    +181
    Local Time:
    11:47 AM
    The problem with editing the php.ini is it is overwritten every time you upgrade php.
     
  6. eva2000

    eva2000 Administrator Staff Member

    31,001
    6,920
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,426
    Local Time:
    3:47 AM
    Nginx 1.13.x
    MariaDB 5.5
    yes but old backup of all php.lini settings file is created on php upgrade at /usr/local/lib/php.ini-oldversion_DATESTAMP see lines 183 to 218 of inc/php_upgrade.inc centminmod/php_upgrade.inc at master · centminmod/centminmod · GitHub and auto reedited via phpsededit function on line 198 centminmod/php_upgrade.inc at master · centminmod/centminmod · GitHub

    you can also edit and customise the phpsededit function values via inc/phpsededit.inc see centminmod/phpsededit.inc at master · centminmod/centminmod · GitHub

    Code:
    phpsededit() {
        if [[ "$(date +"%Z")" = 'EST' ]]; then
        sed -i "s/;date.timezone =/date.timezone = Australia\/Brisbane/g" /usr/local/lib/php.ini
        else
        sed -i "s/;date.timezone =/date.timezone = UTC/g" /usr/local/lib/php.ini
        fi
    
        sed -i 's/max_execution_time = 30/max_execution_time = 60/g' /usr/local/lib/php.ini
        sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/lib/php.ini
        sed -i 's/;realpath_cache_size = 16k/realpath_cache_size = 4096k/g' /usr/local/lib/php.ini
        sed -i 's/;realpath_cache_ttl = 120/realpath_cache_ttl = 360/g' /usr/local/lib/php.ini
        sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 15M/g' /usr/local/lib/php.ini
        #sed -i 's/memory_limit = 128M/memory_limit = 256M/g' /usr/local/lib/php.ini
        sed -i 's/post_max_size = 8M/post_max_size = 15M/g' /usr/local/lib/php.ini
        sed -i 's/expose_php = On/expose_php = Off/g' /usr/local/lib/php.ini
        #sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/lib/php.ini
        #sed -i 's/disable_functions =/disable_functions=exec,passthru,shell_exec,system,proc_open,popen/g' /usr/local/lib/php.ini
        sed -i 's/mail.add_x_header = On/mail.add_x_header = Off/g' /usr/local/lib/php.ini
    
        sed -i 's/;max_input_nesting_level = 64/max_input_nesting_level = 128/g' /usr/local/lib/php.ini
        sed -i 's/; max_input_vars = 1000/max_input_vars = 2000/g' /usr/local/lib/php.ini
        sed -i 's/;mysqlnd.net_cmd_buffer_size = 2048/mysqlnd.net_cmd_buffer_size = 16384/g' /usr/local/lib/php.ini
    
    # for mysqlnd native driver default mysql.sock configuration
    #echo "mysql.default_socket=/var/lib/mysql/mysql.sock" > /root/centminmod/php.d/mysqlsocket.ini
    #echo "mysqli.default_socket=/var/lib/mysql/mysql.sock" > /root/centminmod/php.d/mysqlsocket.ini
    
    }
    just uncomment (remove the front hash #) from
    Code:
        #sed -i 's/memory_limit = 128M/memory_limit = 256M/g' /usr/local/lib/php.ini
    to become
    Code:
        sed -i 's/memory_limit = 128M/memory_limit = 256M/g' /usr/local/lib/php.ini
    As such Centmin Mod should then already always default to memory_limit = 256M even on PHP upgrades. It isn't done as default as ~40% of Centmin Mod users are on 32bit CentOS with <512MB VPS servers.