Get the most out of your Centmin Mod LEMP stack
Become a Member

PHP-FPM Transfer all my custom changes from php.info to php-fpm config

Discussion in 'Centmin Mod Insights' started by rdan, Aug 28, 2014.

  1. rdan

    rdan Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:31 AM
    Mainline
    10.2
    From now on I want to moved all my custom changes from php.ini for easier upgrade.
    So I don't want to apply my custom codes directly to php.ini,, instead I want to use my php-fpm config.
    Right now I have this:
    Code:
    php_admin_value[error_log] = /var/log/php-fpm/www-php.error.log
    php_admin_value[date.timezone] = Asia/Manila
    php_admin_value[memory_limit] = 256M
    How can I convert this php.ini value to php-fpm config?
    Code:
    session.save_handler = memcached
    session.save_path = "127.0.0.1:11211"
    sendmail_path = /usr/lib/sendmail.postfix -t -i
    Is it something like?
    Code:
    php_admin_value[session.save_handler] = memcached
    php_admin_value[session.save_path] = "127.0.0.1:11211"
    php_admin_value[sendmail_path] = /usr/lib/sendmail.postfix -t -i

     
  2. eva2000

    eva2000 Administrator Staff Member

    36,009
    7,897
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,178
    Local Time:
    12:31 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Whenever Nginx or PHP-FPM is upgraded via centmin.sh, the script auto backups previous versions config files. See lines 183 to 218 of inc/php_upgrade.inc

    For php.ini you can find the timestamped php.ini files at /usr/local/lib

    Code:
    ls -lahrt /usr/local/lib/ | grep php.ini
    -rw-r--r--  1 root root  64K May 23 17:07 php.ini-oldversion_240514-030712
    -rw-r--r--  1 root root  68K May 30 16:12 php.ini-oldversion_300514-161116
    -rw-r--r--  1 root root  68K Jun 27 12:40 php.ini-oldversion_270614-123922
    -rw-r--r--  1 root root  68K Jul 24 12:57 php.ini-oldversion_240714-125702
    -rw-r--r--  1 root root  68K Aug  3 19:13 php.ini-oldversion_030814-191244
    -rw-r--r--  1 root root  68K Aug  3 20:04 php.ini-oldversion_030814-200356
    -rw-r--r--  1 root root  68K Aug 22 20:14 php.ini-oldversion_220814-201339
    -rw-r--r--  1 root root  68K Aug 28 12:22 php.ini-oldversion_280814-122201
    -rw-r--r--  1 root root  71K Aug 28 12:48 php.ini
    can use sdiff to see side by side differences

    Code:
    sdiff -s /usr/local/lib/php.ini-oldversion_280814-122201 /usr/local/lib/php.ini
    This would give you an idea of the changes.

    If you want to retain php.ini changes don't use php-fpm config but you can instead just move them into their own /etc/centminmod/php.d/custom.ini file using normal php.ini syntax :)
     
    Last edited: Aug 29, 2014
    • Like Like x 1
  3. rdan

    rdan Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:31 AM
    Mainline
    10.2
    On /etc/centminmod/php.d/
    Custom php config should be named custom.ini or any file name will do? like phpcustom.ini.
    It's also fine to just copy my whole php.ini content? Or just those line that I have custom values?
     
  4. eva2000

    eva2000 Administrator Staff Member

    36,009
    7,897
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,178
    Local Time:
    12:31 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    any filename.ini with *.ini extension will do and only copy in your custom values as you don't know what future PHP version changes or deprecated values pop up (hence why on php-fpm upgrade the old php.ini is backed up and new php.ini for the upgraded PHP version is used)
     
  5. rdan

    rdan Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:31 AM
    Mainline
    10.2
    So I just create a new file @ /etc/centminmod/php.d/
    With this content:
    Code:
    memory_limit = 256M
    date.timezone = Asia/Manila
    session.save_handler = memcached
    session.save_path = "127.0.0.1:11211"
    sendmail_path = /usr/lib/sendmail.postfix -t -i
     
  6. eva2000

    eva2000 Administrator Staff Member

    36,009
    7,897
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,178
    Local Time:
    12:31 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    yup :)

    then restart php-fpm service either via
    Code:
    service php-fpm restart
    
    or command shortcut
    Code:
    fpmrestart
    
     
    • Like Like x 1
  7. rdan

    rdan Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:31 AM
    Mainline
    10.2
    Best approach!
    Since 5.5.16 to 5.6.0 has a lot of changes on php.ini ;)
    Flawless upgrade ;)

    upload_2014-8-28_22-44-10.png


    Have a nice day Eva!
    Thanks for your time.
     
    • Like Like x 1
  8. eva2000

    eva2000 Administrator Staff Member

    36,009
    7,897
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,178
    Local Time:
    12:31 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Excellent (y)
     
  9. rdan

    rdan Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:31 AM
    Mainline
    10.2
    PHP upgrade now restart memcached also?
    I notice that my memcached status was reset and also restarted but I didn't restart memcached myself.
     
  10. eva2000

    eva2000 Administrator Staff Member

    36,009
    7,897
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,178
    Local Time:
    12:31 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    PHP upgrades between major versions auto recompile all detected custom PHP extensions including memcache & memcached as well as memcached server :) For minor PHP version upgrades it will skip it i.e. 5.6.0 to 5.6.1
     
    • Like Like x 1
  11. rdan

    rdan Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:31 AM
    Mainline
    10.2
    Perfect ;)
    Thanks!
     
  12. Afterward

    Afterward Member

    94
    29
    18
    Jul 20, 2014
    Ratings:
    +29
    Local Time:
    3:31 AM
    1.7.5
    5.5
    So we just create the custom file and its gonna load it by itself or i'm missing something?
     
  13. rdan

    rdan Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:31 AM
    Mainline
    10.2
    Yes.
     
    • Like Like x 1
  14. eva2000

    eva2000 Administrator Staff Member

    36,009
    7,897
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,178
    Local Time:
    12:31 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  15. Afterward

    Afterward Member

    94
    29
    18
    Jul 20, 2014
    Ratings:
    +29
    Local Time:
    3:31 AM
    1.7.5
    5.5
    Alright this is what i did
    Code:
    /etc/centminmod/php.d/custom.ini
    upload_max_filesize = 150M
    post_max_size = 150M
    
    Yet no changes have been made at all, i'm i doing it wrong?
     
  16. rdan

    rdan Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:31 AM
    Mainline
    10.2
    • Like Like x 1
  17. Afterward

    Afterward Member

    94
    29
    18
    Jul 20, 2014
    Ratings:
    +29
    Local Time:
    3:31 AM
    1.7.5
    5.5
    Thanks, worked like a charm.
     
  18. pamamolf

    pamamolf Well-Known Member

    3,113
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    5:31 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Does that help on any php software or is related to Xenforo only?

    Code:
    session.save_handler = memcached
    session.save_path = "127.0.0.1:11211"
    For example can this help with IPB forum?
     
  19. rdan

    rdan Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:31 AM
    Mainline
    10.2
    I think yes.
     
    • Like Like x 1
  20. pamamolf

    pamamolf Well-Known Member

    3,113
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    5:31 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Thanks RoldanLT :)

    Do i have to restart only phpfpm after this edit or nginx and memcached also?

    How can i verify that i am using memcached after the change and the restart?
     
    Last edited: Mar 28, 2015
..