Difference Between php_admin_value[memory_limit] and php.ini memory_limit

9,645

Solution 1

There is no difference. There are different ways to set the same PHP configuration parameter. It's useful - for example - if you have a generic php.ini which gets loaded in all PHP-FPM pools, but in one of them you want to override a certain value - like memory_limit

See http://php.net/manual/en/configuration.changes.php

Solution 2

One difference between memory_limit = 256M in php.ini and php_admin_value[memory_limit] = 32M in pool.d/www.conf is that you can use ini_set('memory_limit','512M') to override the setting in php.ini but you can't override values set with php_admin_value.

Use php_value[memory_limit] = 32M if you want to allow it to be overridden. (php_value vs php_admin_value)

Share:
9,645

Related videos on Youtube

Neel
Author by

Neel

Previously know as @blackops_programmer. I know, it was a pretty lame Display name.

Updated on September 18, 2022

Comments

  • Neel
    Neel over 1 year

    I have Nginx + php-fpm + Mysql. With the php memory settings, I always set this in php.ini like this:

    memory_limit = 256M
    

    Now, I bumped into another similar looking setting in pool.d/www.conf file like this:

    ;php_admin_value[memory_limit] = 32M
    

    My questions:

    Although the doc says what that does, I couldnt read anywhere on what's the difference between memory_limit setting in php.ini and the php_admin_value[memory_limit] in www.conf?

    Do I need to set both or setting both makes it redundant?

    Under what scenario do I need to specify the limit in php_admin_value[memory_limit] instead of adding it to memory_limit in php.ini?

    Can someone clear my confusion please?

  • Neel
    Neel over 9 years
    Thanks. So just having it in php.ini should be good enough then.
  • Adnan Yaqoob
    Adnan Yaqoob over 9 years
    Good enough. right.