Jump to content
The Uniform Server Community
Hoo Host

Can't increase memory limit for PHP?

Recommended Posts

Hi all, any input on this or even confirmation that it's an issue that others have encountered would be greatly appreciated:

 

I just recently made the upgrade to Uniserver Zero XIII with PHP 7.0. The issue is that half my sites (mainly WordPress but that's irrelevant) keep failing with out of memory errors. These same sites worked just fine on the older Uniserver Zero XI. I have written a little script to illustrate what is happening - PHP is ignoring the set memory limit and restricting it to some amount under 408MB. It doesn't matter if it is set in the php_production.ini file, via .htaccess, or via ini_set() in the php script itself. As you can see from the phpinfo.html output below it is configured at 2048MB (I have also tried at 512 and 1024 with no difference in results). I have tried installing the PHP 7.1 module with no luck there either.

 

Here is my phpinfo: http://hoohost.com/dev/us/phpinfo.html

 

16GB physical RAM, never close to using half of it.

 

Test script - note that the output shows that it never allows more than ~408MB (240MB after loading other local sites) even though it is set to max out at 2048MB in php,ini config:

<?php
	echo "Memory limit: ".ini_get("memory_limit")."<br><br>";
	$a=array();
	if (ob_get_level() == 0) ob_start();
	for($i=0;$i<200;$i++)
	{
		$a[]=str_pad('',1024*1024*8);
		echo "Pass ".$i.", memory used: ".number_format((memory_get_usage())/(1024*1024),0)." MB<br>";
		ob_flush();
		flush();
	}
?>

Output: after starting UniServer Apache without loading any other local sites:

Memory limit: 2048M


Pass 0, memory used: 11 MB
Pass 1, memory used: 21 MB
Pass 2, memory used: 31 MB
Pass 3, memory used: 41 MB
Pass 4, memory used: 51 MB
Pass 5, memory used: 61 MB
Pass 6, memory used: 71 MB
Pass 7, memory used: 81 MB
Pass 8, memory used: 91 MB
Pass 9, memory used: 101 MB
Pass 10, memory used: 111 MB
Pass 11, memory used: 121 MB
Pass 12, memory used: 131 MB
Pass 13, memory used: 141 MB
Pass 14, memory used: 151 MB
Pass 15, memory used: 161 MB
Pass 16, memory used: 171 MB
Pass 17, memory used: 181 MB
Pass 18, memory used: 191 MB
Pass 19, memory used: 201 MB
Pass 20, memory used: 211 MB
Pass 21, memory used: 221 MB
Pass 22, memory used: 231 MB
Pass 23, memory used: 241 MB
Pass 24, memory used: 251 MB
Pass 25, memory used: 261 MB
Pass 26, memory used: 271 MB
Pass 27, memory used: 281 MB
Pass 28, memory used: 291 MB
Pass 29, memory used: 301 MB
Pass 30, memory used: 311 MB
Pass 31, memory used: 321 MB
Pass 32, memory used: 331 MB
Pass 33, memory used: 341 MB
Pass 34, memory used: 351 MB
Pass 35, memory used: 361 MB
Pass 36, memory used: 371 MB
Pass 37, memory used: 381 MB

Fatal error: Out of memory (allocated 400556032) (tried to allocate 8388632 bytes) in C:\Uniserver\www\util\memtest.php on line 9

 

Output: after loading another local (in this case WordPress) site's admin page:

Memory limit: 2048M


Pass 0, memory used: 11 MB
Pass 1, memory used: 21 MB
Pass 2, memory used: 31 MB
Pass 3, memory used: 41 MB
Pass 4, memory used: 51 MB
Pass 5, memory used: 61 MB
Pass 6, memory used: 71 MB
Pass 7, memory used: 81 MB
Pass 8, memory used: 91 MB
Pass 9, memory used: 101 MB
Pass 10, memory used: 111 MB
Pass 11, memory used: 121 MB
Pass 12, memory used: 131 MB
Pass 13, memory used: 141 MB
Pass 14, memory used: 151 MB
Pass 15, memory used: 161 MB
Pass 16, memory used: 171 MB
Pass 17, memory used: 181 MB
Pass 18, memory used: 191 MB
Pass 19, memory used: 201 MB
Pass 20, memory used: 211 MB
Pass 21, memory used: 221 MB

Fatal error: Out of memory (allocated 232783872) (tried to allocate 8388632 bytes) in C:\Uniserver\www\util\memtest.php on line 9

Share this post


Link to post
Share on other sites

I found a solution! But since nobody is capable of replying I'm not going to explain. Good luck!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...