1

Does enabling the configuration option with-config-file-scan-dir when compiling PHP lead to performance issues?

Specifically, does this tell the PHP binary to do a file system scan every time the PHP module is loaded to respond to a request?

I imagine it does, and that having multiple ini files causes just a little more disk access on every request. I suppose this could be mitigated by placing all those separate directives into the same php.ini file.

Can anyone confirm or deny this?

0

3 Answers 3

2

Bryan,

The CLI/(Fast)CGI versions do load the .ini files each time they are fired up; however, the apache module loads them once into memory when the server is started. You can test this behavior by changing a value in any of the .ini files and running the CLI binary. Notice that you need a server restart before you can see the changes in the server module version.

Sign up to request clarification or add additional context in comments.

Comments

1

No, If I understand it correctly you will provide it a directory which when the PHP config is loaded (at apache startup) PHP will read every file in the directory as a config file.

Some info here and more here (better link)

1 Comment

Thanks - that makes sense. I thought it loaded those conf files on each HTTP request. Didn't realize that it loaded them when Apache was started up.
1

Does this tell the PHP binary to do a file system scan every time the PHP module is loaded to respond to a request?

No. When you compile --with-config-file-scan-dir=/path/to/dir all you're doing is telling PHP combine all files in this directory into its configuration. This is a method often used in system configuration where package management systems need to be able to add/remove package specific configuration from an application without potentially destroying a end-user modified config file. An example here would be, on a Debian based system, when you apt-get install php-pgsql, it will create a /etc/php/conf.d/pgsql.ini which will contain the extension=pgsql.so line, as well as any module-specific options.

Does enabling the configuration option with-config-file-scan-dir when compiling PHP lead to performance issues?

Not really. In practice, it is simply a concatenation of all the .ini files in that particular directory.

I can tell you that Debian, CentOS, and Zend Server all use this option by default.

Also, just off the top of my head, *nix RC files, Apache2, Courier, Emacs, and Cron all use (or can use) similar approaches to loading configurations.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.