Bug #14643
closedmemory_limit too low error, but not enabled during compile of PHP v4.3.2 and up
0%
Description
In the install the following error might be given:
===Begin Typo3 Install tool output snippet:===
Memory Limit below 16 MB
memory_limit=
Your system is configured to enforce a memory limit of PHP scripts
lower than 16 MB. The Extension Manager needs to include more
PHP-classes than will fit into this memory space. There is nothing
else to do than raise the limit. To be safe, ask the system
administrator of the webserver to raise the limit to over 25 MB.
===End snippet===
http://www.php.net/manual/en/ini.core.php#ini.memory-limit
It says:
================================
memory_limit integer
This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. In order to use this directive you must have enabled it at compile time. So, your configure line would have included: --enable-memory-limit. Note that you have to set it to -1 if you don't want any limit for your memory.
As of PHP 4.3.2, and when memory_limit is enabled, the PHP function memory_get_usage() is made available.
When an integer is used, the value is measured in bytes. You may also use shorthand notation as described in this FAQ .
See also: max_execution_time .
I am using PHP 4.3.10, so the above function would be enabled if memory_limit is enabled, and memory_get_usage() is definately not enabled based on a test script: ================================
So that variable might not have been enabled during compile. Typo3 should check for the memory_get_usage function's existance before checking for a high enough number in memory_limit
Use what you want from the following script.
===Begin variable/function checking (overkill) script===
//NOTE: This script is major overkill and very redundant, just to make sure ;)
if (defined(ini_get('memory_limit'))) {
echo "It appears that the memory_limit is defined (constant)<br />";
} else {
echo "memory_limit is not defined as a constant.<br />";
}
/*if (isset(ini_get('memory_limit'))) {
echo "It appears that memory_limit is defined (variable)<br />";
} else {
echo "memory_limit is not defined as a variable.<br />";
}*/
/*The above commented block caused the error:
Parse error: parse error, unexpected T_STRING, expecting T_VARIABLE or
'$' in /home/cognifir/public_html/admin/php.php on line 7*/
echo 'memory_limit= ' . ini_get('memory_limit') . '<br />';
echo "The above line should have had the value for memory_limit.<br />";
if (ini_get('memory_limit')=="") {
echo "However, it appears that memory_limit does not have a value<br />";
} else {
echo "And it appears that memory_limit does in fact hold some value<br />";
}
if (is_null(ini_get('memory_limit'))) {
echo "Also, it appears that memory_limit is null<br />";
} else {
echo "And it appears that memory_limit is NOT null<br />";
}
if (function_exists('memory_get_usage')) {
echo "The memory_get_usage function exists!<br />";
} else {
echo "It appears the memory_get_usage function does not exist.<br />";
}
echo 'memory_get_usage() returns: ' . memory_get_usage();
?>
===End of overkill checking script===
===Output of script===
memory_limit is not defined as a constant.
memory_limit=
The above line should have had the value for memory_limit.
However, it appears that memory_limit does not have a value
And it appears that memory_limit is NOT null
It appears the memory_get_usage function does not exist.
Fatal error: Call to undefined function: memory_get_usage() in
/home/cognifir/public_html/admin/php.php on line 36
===End of output===
Also, phpinfo() doesn't have memory_limit listed at all as a variable or anywhere else when --enable-memory-limit is not used at compile time (which you can see from the 'Configure Command' entry in phpinfo() near the top).
(issue imported from #M942)