Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

PHP memory limit problem


Reply

11 Posts   6915 Views

Avatar
Jagged

31 January 2007 at 2:23pm (Last edited: 31 January 2007 2:54pm), Community Member, 2 Posts

I tried to install SS on my development machine running Vertrigo WAMP and had simlar issues with a null memory limit. I tracked it down to the fact that PHP was compiled without --enable-memory-limit.
If you do choose to subvert the installation by editing the install.php file, then you should be fine as there will be no limit at all on the memory.
However, this is a security risk on shared servers as any Idiot can bring the server to it's knees with a recursive function. :)

Considering the fact that most/all Apache installations on windows are compiled without --enable-memory-limit since it is not supported on windows, I suggest the following patch:
function requireMemory($min, $recommended, $testDetails) {
      $this->testing($testDetails);
      $mem = $this->getPHPMemory();
      if (!$mem) {
         $testDetails[2] .= " You have PHP compiled without --enable-memory-limit";
         $this->warning($testDetails);
      } else {
      if($mem < $min) {
         $testDetails[2] .= " You only have " . ini_get("memory_limit") . " allocated";
         $this->error($testDetails);
      } else if($mem < $recommended) {
         $testDetails[2] .= " You only have " . ini_get("memory_limit") . " allocated";
         $this->warning($testDetails);
      }}
   }   
to config-form.html:

<?php if($hasErrorOtherThanDatabase) { ?>
<p class="error">You aren't currently able to install the software. Please <a style="color: #CCF" href="#requirements">see below</a> for details.</p>
<?php } else { ?>
<?php if($req->hasWarnings()) { ?>
<p class="warning">There are some issues that we recommend you look at before installing, however, you are still able to install the software. Please see below for details.</p>
<?php } else if(!$dbReq->hasErrors()) { ?>
<p class="good">You're ready to install! &nbsp;&nbsp;
</p>
<?php } ?>

Avatar
Sam

1 February 2007 at 7:01pm (Last edited: 1 February 2007 7:02pm), Administrator, 685 Posts

Thanks for the patch, Jagged - we'll be putting this into version 2.0.0, due out very soon.

Avatar
Matt

1 February 2007 at 8:00pm Core Development Team, 84 Posts

This has been fixed in our latest version (cheers Jagged, that's pretty much exactly what we did), due out shortly.

You will be able to install SilverStripe if you have between 20 MB and 32 MB of memory allocated, and also if we can't determine what the value of memory_limit is.