It’s odd that there’s no memory_limit reported in your phpinfo.
I suspect that it’s not there because it’s not really set for some reason (maybe the php.ini file isn’t being read).
That’s what MODx tests.
If you’re sure the memory limit is ok, you could try changing the code in
setup/includes/modinstalltest.php around line 68 to bypass the memory check. Just set $success = true and comment out the actual tests.
It would probably be a lot better, though, to find out why ini_get(’memory_limit’) is returning less than 32M. You might check with your host or the host’s support forum.
I really need more specific instructions.
Setting succes to true is simple enough, but I have tried every combination I can think of can not comment anything out that will do anything other than return a blank page. Every line or combination of lines gives the same results or the same memeory error.
Could you please explain how to "comment out the actual tests"?
As for the initial error, it is all over the web...the function does not always work and there other suggestions such as making the script use get_cfg_var().
"Many ini memory size values, such as upload_max_filesize, are stored in the php.ini file in shorthand notation. ini_get() will return the exact string stored in the php.ini file and NOT its integer equivalent. Attempting normal arithmetic functions on these values will not have otherwise expected results. The example above shows one way to convert shorthand notation into bytes, much like how the PHP source does it. "
Just search "ini_get(’memory_limit’)".
You’re right about the problems with ini_get().
Try just changing this:
$ml = ini_get('memory_limit');
To this:
$ml = get_cvg_var('memory_limit');
BTW, can you check to see if your host is using either suPHP or suExec?
I think the problem is that ini_get(’memory_limit’) is purported to return an empty string under some circumstances. If and when that happens, MODx won’t install.
I’m still wondering, though, why the OPs phpinfo() shows no memory_limit.
$ml = get_cvg_var(’memory_limit’); causes a blank page, so no luck.
suexec Status is enabled.
There is also an option to install ’EasyApache 3’.
Any other ideas as to what I can do?
This is just a normal dedicated apache server from hostforweb.com. It certainly should be a quite normal setup and I have full root access.
Can I just "Just set $success = true and comment out the actual tests"?
Can you detail that or is it not going to work?
-
MODX Staff
- 10,725 Posts
If using suexec, you will need to put a php.ini file in every folder from which PHP scripts are accessed in order to increase the memory_limit. In this case, it would have to be in setup/.
You may need to specify where the php.ini file is by putting this in your .htaccess file:
SetEnv PHPRC /path/to/php.ini/dir
I’m not sure if that eliminates the need to put a php.ini in every dir.
If your memory limit really is high enough, adding the line shown below should get you past the test:
<?php
function checkMemoryLimit() {
$success = false;
$ml = ini_get('memory_limit');
$bytes = $this->return_bytes($ml);
if ($bytes < 67108864) { /* 32M = 33554432, 64M = 67108864 */
$success = @ini_set('memory_limit','128M');
$success = $success !== false ? true : false;
} else {
$success = true;
}
$success=true; // ADD THIS LINE
$this->results['memory_limit']['msg'] = '<p>'.$this->install->lexicon['test_memory_limit'].' ';
if ($success) {
$this->results['memory_limit']['msg'] .= '<span class="ok">'.$this->install->lexicon['ok'].'</span></p>';
$this->results['memory_limit']['class'] = 'testPassed';
} else {
$s = '<span class="notok">'.$this->install->lexicon['failed'].'</span>';
$s .= '<div class="notes"><p>'.sprintf($this->install->lexicon['test_memory_limit_fail'],$ml).'</p></div>';
$s .= '</p>';
$this->results['memory_limit']['msg'] .= $s;
$this->results['memory_limit']['class'] = 'testFailed';
}
}