8

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?

2 Answers 2

6

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)

4

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

2
  • Thanks. So just having it in php.ini should be good enough then.
    – Neel
    Jan 18, 2015 at 17:18
  • Good enough. right.
    – gue
    Jan 18, 2015 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.