The Note You're Voting On
leo ¶ 14 years ago
Just developed the probably first php.ini hack to add commands which will only be parsed before PHP 5.3 when using mod_php.
<?php
# Disable eAccelerator by default
eaccelerator.enable = 0
# Now, to prevent incompatibilities with Zend Optimizer+, we
# want to enable eAccelerator only in PHP 5.2 or lower.
[HOST=*]
eaccelerator.enable = 1
?>
What is happening here? In PHP 5.3, php.ini sections to set up PHP on a per host basis have been introduced:
http://www.php.net/manual/en/ini.sections.php
These sections only work in CGI/FastCGI mode, however there still seems to be a difference in how the php.ini file is parsed in PHP 5.2 and PHP 5.3 when using mod_php: PHP 5.3 ignores everything below the line [HOST=*], whereas PHP 5.2 does not.
In the above example, PHP 5.3 only reads "eaccelerator.enable = 0" and then stops at the invalid command [HOST=*]. However, PHP 5.2 seems to ignore the invalid command and parses the whole configuration file, ending up with "eaccelerator.enable = 1".