Jump to content


Hoo Host

Member Since 30 May 2019
Offline Last Active Jun 13 2019 08:31 AM
-----

Topics I've Started

Can't increase memory limit for PHP?

12 June 2019 - 10:17 PM

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

How to set up 64-bit Apache on Windows 7 (Uniserver Zero XIII)

05 June 2019 - 04:16 PM

Hi All,

 

I have been getting the error below many many times in the Apache log with the standard (stock) version of Uniserver Zero XIII and then Apache will crash.

 

VirtualAlloc() failed: [0x00000008] Not enough storage is available to process this command.
VirtualFree() failed: [0x000001e7] Attempt to access invalid address.
 

I have narrowed this down to the Apache version being 32-bit and not supporting memory in excess of 2GB (presumably it will hit a memory allocation error when it tries to allocate more than this amount), I would like to upgrade to 64-bit Apache (downloaded from the closest thing to an official release here: https://www.apachelo...download/win64/) but when I replace the core/apache2/bin contents or the core/apache2 contents I cannot get it to start using UniController - it no longer recognizes the ${US_ROOTF_WWW} and other variables in the config files.

 

Does anyone have a step-by-step for upgrading Apache to the 64-bit version or alternatively does anyone know where/how the ${US_ROOTF_WWW} and other config values are set so that I can try to update them manually?

 

Thanks!