PHP 4.3.1, ini_set, ini_get, memory_limit, and max_input_time
| From: | Raymond C . Rodgers | Date: | Sun, 06 Jul 2003 18:35:13 +0000 |
| Subject: | PHP 4.3.1, ini_set, ini_get, memory_limit, and max_input_time | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-154140@lists.php.net to get a copy of this message | ||
While documenting I just wrote for a client, I noted that there were several
server variables (in the form of php.ini configuration settings) that might
come into play that were generally the responsibility of the web master of
the server, and thus beyond my control.
These were memory_limit, max_input_time, and max_execution_time.
According to http://www.php.net/function.ini-set ,
any item with the value
"PHP_INI_ALL" in the "changeable" column should be abe to be set in any of
the described methods in PHP. (Configuration file, .htaccess file, or through
ini_set()/ini_alter().)
One of the user contributed notes seems to contradict this information saying
that "directives with PHP_INI_PERDIR or PHP_INI_ALL" may only be set in
.htaccss files. (And I presume the php.ini file as well.) Both memory_limit
and max_execution_time are listed as PHP_INI_ALL, but max_input_time isn't
even listed on the page.
These discrepencies need to be remedied obviously, but it gets stranger still
for me. Just to verify that these are not changeable in my script, I added a
few calls to ini_set() to do some testing. Here is the relevant snippet:
$output=ini_set("max_input_time","120");
if ($output!=false) {
$output=ini_get("max_input_time");
echo "<!-- new input time: $output -->\n";
} else
echo "<!-- problem setting max input time -->\n";
$output=ini_set("max_execution_time","120");
if ($output!=false) {
$output=ini_get("max_execution_time");
echo "<!-- new execution time: $output -->\n";
} else
echo "<!-- problem setting max execution time -->\n";
$output=ini_set("memory_limit","12M");
if ($output!=false) {
$output=ini_get("memory_limit");
echo "<!-- new memory limit: $output -->\n";
} else
echo "<!-- problem setting memory limit -->\n";
And here are the results from the page source:
<!-- problem setting max input time -->
<!-- new execution time: 120 -->
<!-- problem setting memory limit -->
So what this tells me is that it is possible to change the execution time
from with-in the page, but it is not possible to change the input time or the
memory limit. This wouldn't bother me except that both memory_limit and
max_execution_time are supposed to be changeable in the same places.
max_input_time might be as well, but I didn't see any documentation on it. So
what gives?
On a little further testing, I wasn't even able to get a return value for
memory_limit with ini_get()... Am I seeing some bizarre behavior that might
be specific to my OpenBSD/Apache server? (In short, will this work properly
on the Red Hat Linux/Apache installation that this script will be placed on?)
Or is this a known bug in PHP 4.3.1? (As I seem to have no problem with a few
other ini_get() calls.) Or is this behavior just as strange to all of you?
Thanks,
Raymond
--
Raymond C. Rodgers
http://bbnk.dhs.org/~rrodgers/
http://www.j-a-n.net/