MDL-9363 update memory limit checks and docs; merged from MOODLE_18_STABLE
This commit is contained in:
+5
-5
@@ -1020,14 +1020,14 @@ function get_memory_limit() {
|
||||
|
||||
function check_memory_limit() {
|
||||
|
||||
/// if limit is already 16M or more then we don't care if we can change it or not
|
||||
if ((int)str_replace('M', '', get_memory_limit()) >= 16) {
|
||||
/// if limit is already 40 or more then we don't care if we can change it or not
|
||||
if ((int)str_replace('M', '', get_memory_limit()) >= 40) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
/// Otherwise, see if we can change it ourselves
|
||||
@ini_set('memory_limit', '16M');
|
||||
return ((int)str_replace('M', '', get_memory_limit()) >= 16);
|
||||
@ini_set('memory_limit', '40M');
|
||||
return ((int)str_replace('M', '', get_memory_limit()) >= 40);
|
||||
}
|
||||
|
||||
//==========================================================================//
|
||||
|
||||
@@ -214,17 +214,17 @@ $string['memorylimithelp'] = '<p>The PHP memory limit for your server is current
|
||||
<p>This may cause Moodle to have memory problems later on, especially
|
||||
if you have a lot of modules enabled and/or a lot of users.</p>
|
||||
|
||||
<p>We recommend that you configure PHP with a higher limit if possible, like 16M.
|
||||
<p>We recommend that you configure PHP with a higher limit if possible, like 40M.
|
||||
There are several ways of doing this that you can try:</p>
|
||||
<ol>
|
||||
<li>If you are able to, recompile PHP with <i>--enable-memory-limit</i>.
|
||||
This will allow Moodle to set the memory limit itself.</li>
|
||||
<li>If you have access to your php.ini file, you can change the <b>memory_limit</b>
|
||||
setting in there to something like 16M. If you don\'t have access you might
|
||||
setting in there to something like 40M. If you don\'t have access you might
|
||||
be able to ask your administrator to do this for you.</li>
|
||||
<li>On some PHP servers you can create a .htaccess file in the Moodle directory
|
||||
containing this line:
|
||||
<p><blockquote>php_value memory_limit 16M</blockquote></p>
|
||||
<p><blockquote>php_value memory_limit 40M</blockquote></p>
|
||||
<p>However, on some servers this will prevent <b>all</b> PHP pages from working
|
||||
(you will see errors when you look at pages) so you\'ll have to remove the .htaccess file.</p></li>
|
||||
</ol>';
|
||||
|
||||
Reference in New Issue
Block a user