5

Is there a way to read a module's configuration ini file?

For example I installed php-eaccelerator (http://eaccelerator.net) and it put a eaccelerator.ini file in /etc/php.d. My PHP installation wont read this .ini file because the --with-config-file-scan-dir option wasn't used when compiling PHP. Is there a way to manually specify a path to the ini file somewhere so PHP can read the module's settings?

3 Answers 3

4

This is just a wild guess, but try to add all the directives from eaccelerator.ini to php.ini. First create a <?php phpinfo(); ?> and check where it's located.

For example, try this:

[eAccelerator]
extension="eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/tmp"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

Another thing you could do is set all the settings on run-time using ini_set(). I am not sure if that works though or how effective that is. :) I am not familiar with eAccelerator to know for sure.

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

Comments

1

The standard way in this instance is to copy the relevant .ini lines to the bottom of the php.ini file. There is no 'include "file.ini"' functionality in the php.ini file itself.

You can't do it at run time either, since the extension has already been initialised by then.

Comments

0

If using Apache, and mod-php, you can configure/override some php settings locally with a .htaccess file. Your webserver has to "AlloweOverride" appropriately in the main config file to allow you to override these settings locally. In my experience, many hosting companies will let you set php settings via htaccess.

(thanks commenter for pointing out this only works with mod-php)

2 Comments

You mean Apache and mod_php. Apache and PHP as (f)cgi will ignore .htaccess unless you employ htscanner.
There are a number of PHP.ini settings that cannot be set in a .htaccess file (for security concerns, among others). Loading extensions is one such php.ini only configuration. us2.php.net/manual/en/ini.php#ini.list

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.