4

I just transferred one site from Linux to Windows and I'm getting strange fatal error messages. My Linux PHP had a 256MB memory limit and never had a single "out of memory" fatal error.

Now on IIS I have the same memory limit but I'm receiving too many

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32508940 bytes) in C:\...\functions.php on line 0

I tried to increase (400MB) to see what will happened and this is what I got

PHP Fatal error:  Allowed memory size of 419430400 bytes exhausted (tried to allocate 65013862 bytes) in C:\....\dbfunctions.php on line 1073741824

Strange, it's the same application, same memory limit settings.. Also strange is that 2nd error says "on line 1073741824" but wow, that file has 500 lines. Is this a Windows/IIS/PHP problem?

My config: IIS 8.0, PHP 5.3.28, PHP handler php-cgi.exe

2
  • What version of IIS and Windows?
    – Citizen
    Feb 1, 2015 at 1:10
  • iis 8.0, windows 2012 standard Feb 1, 2015 at 1:15

1 Answer 1

4

Windows Cache Extension for PHP

There seem to be a plethora of issues that revolve around the windows cache extension for PHP which sets hard memory limits for php.

Microsoft IIS.net Article

There are examples and blog posts where removing wincache solves the issue but this may have a detrimental affect on performance of the site.

An Example of issues related to wincache that sound similar

Managing PHP Memory in IIS

  • php.ini - located in the root folder. Edit in TextPad and change the value for momory_limit. if 4M is not enough up to 8M, etc.

  • In admin.php (if your error is in here) add a memory limit line after ini_set 'memory_limit', '12M' if 12MB of memory is what you're looking to add

  • You can add a line to .htaccess: php_value memory_limit 32M

  • wp-config.php can control memory. You put a line in that looks like this

    define('WP_MEMORY_LIMIT', '32M');

Information pulled from phpbb.com and technet.microsoft.com

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .