Learn about Centmin Mod LEMP Stack today
Register Now

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

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

  1. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    12:57 PM
    Mainline
    10.2
  2. eva2000

    eva2000 Administrator Staff Member

    36,838
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,419
    Local Time:
    2:57 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    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. rdan

    rdan Premium Member Premium Member

    4,363
    1,052
    113
    May 25, 2014
    Ratings:
    +1,521
    Local Time:
    12:57 PM
    Mainline
    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

    36,838
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,419
    Local Time:
    2:57 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    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

    537
    163
    43
    May 25, 2014
    Ratings:
    +216
    Local Time:
    10:57 PM
    The problem with editing the php.ini is it is overwritten every time you upgrade php.
     
  6. eva2000

    eva2000 Administrator Staff Member

    36,838
    8,062
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,419
    Local Time:
    2:57 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    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.
     
..