您的位置:首页 > 编程语言 > PHP开发

php.ini and PHPRC

2013-11-24 10:00 417 查看

Changes to php.ini


PHP reads php.ini files to set various properties. In general, PHP 5.3 is much more restrictive than PHP 5.2.14 (the current production version of PHP). If PHP 5.3 is run in default mode, many applications would fail to function properly.

In an attempt to minimize the differences between PHP 5.2.14 and PHP 5.3, a global php.ini file has been developed to allow PHP 5.3 to more or less mimic PHP 5.2.14 behavior.

How php.ini works


The global file is available at /usr/local/php5.3/php.ini

This global php.ini file is read first, followed by php.ini files in individual accounts which override the global settings. You may adjust your individual php.ini files. NOTE: Placing php.ini files in a directory only affects that directory, unless you use
.htaccess to specify which php.ini to use (see below).

Using PHPRC


A few accounts use a .htaccess file to define PHPRC – an environment variable that points to the php.ini file that should be used in place of the global php.ini file. For example:

SetEnv
PHPRC /ip/my_account/location/php.ini
The end result with PHP 5.3 is that the global php.ini is not read – only the one defined in the .htaccess file via PHPRC. This may cause applications to fail due to the more restrictive defaults set in PHP
5.3. The solution is to change .htaccess files from using PHPRC to PHP_INI_SCAN_DIR. For example:

SetEnv
PHP_INI_SCAN_DIR /ip/my_account/location/php.ini
This change results in the global php.ini file being read first, and then being overwritten with the values defined for the php.ini in PHP_INI_SCAN_DIR.

PHPRC Finder Utility


A utility has been developed that account owners can use to discover if they have .htaccess files that define PHPRC. Simply login to Webserve and type:

find_phprc
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: