php.ini and PHPRC

本文介绍如何通过修改php.ini文件来让PHP 5.3的行为更接近PHP 5.2.14,包括全局php.ini文件的位置及如何使用.htaccess文件指定特定的php.ini文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

anssummer

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值