My memory_limit was set at 8M! And timeout was 30.
If we need to have 128M then why don’t you just set the test as: if <128M set to 128M?
We actually do; however, PHP’s memory_limit function seems to not always be correct in calculating the number, and it definitely doesn’t always work to set the memory_limit at runtime, as certain server configurations prevent one from doing so.
If it fails to set the settings do you warn the user that it failed to set? All I saw was a blank page but no warnings.
$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;
}
$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';
}
// ...
function return_bytes($val) {
$val = trim($val);
$num = intval(substr($val,0,strlen($val)-1));
$last = strtolower(substr($val,strlen($val),1));
switch ($last) {
case 'g':
$num *= 1024;
case 'm':
$num *= 1024;
case 'k':
$num *= 1024;
}
return $num;
}
There are memory_limit warnings in the setup; not sure why yours didn’t prevent installation. Perhaps your configuration is not reporting the proper memory_limit?
What I found after I got nothing but the blank page was that the install had installed the tables and then apparently failed. So wouldn’t it be better if the very first thing was to try to set the ini settings and if they fail to stop the install at that point without loading any tables? That way the only thing the user would have to do would be to set the ini settings and rerun setup. Rather than having to also go into mysql and drop and recreate the database.
Yep, you have to restart Apache.
Also, how do you get the new ini settings to take effect. I usually have to restart Apache to get new ini settings to take effect?
Yep, you have to restart Apache.
The hope is that folks will read the server requirements before even downloading MODx Revolution.
I guess my point was that if those memory settings are needed for a successful install then they cannot be set BY the install. They have to be set before the install. Or the install has to stop and tell the user to restart Apache and rerun the setup. I didn’t see any of this happening. Does the install log what it has detected as far as memory_limit?
Quote from: greno at Oct 14, 2009, 12:32 PMThe hope is that folks will read the server requirements before even downloading MODx Revolution.
I guess my point was that if those memory settings are needed for a successful install then they cannot be set BY the install. They have to be set before the install. Or the install has to stop and tell the user to restart Apache and rerun the setup. I didn’t see any of this happening. Does the install log what it has detected as far as memory_limit?
No, it does not log what it detects as memory_limit, but displays warnings if ini_get(’memory_limit’) does not report a value that is sufficient to support installation.

I most cases, MODx cannot set PHP ini settings like this, these can only be set in server configurations. In cases where it can change them on the fly it does and there is no Apache restart required.
It should not be difficult for the install to stop if it has to reset the ini settings and tell the user to restart Apache and then rerun the install. That would prevent a lot of user installation issues. I agree that people should read the documentation prior to downloading the software but as we all know 96.54321% of all users don’t do that.