31

I'm using PHP5, CodeIgniter and Apache. The localhost php pages were loading fine and then suddenly they started crashing Apache.

The web pages seem to get to different stages of loading when apache crashes.

The only interesting line in the Apache error log file says :

[notice] Parent: child process exited with status 3221225477 -- Restarting.

There is a lot of discussion of this issue on the web but it seems there is no one solution, different people have described different solutions that worked for their system.

Suggestions Appreciated.

3
  • 2
    I just ran into this exact problem, and the solution below (copying the DLLs into System32) did not work for me. Anyone else have ideas?
    – Arkaaito
    Mar 3, 2010 at 20:58
  • 12
    FWIW: 3221225477 is C0000005 in hexadecimal, and that error code happens to mean "access violation". There can be many different reasons for those. Apr 28, 2010 at 13:06

15 Answers 15

60

This problem often happens in Windows because of smaller Apache’s default stack size. And it usually happens when working with php code that allocates a lot of stacks.

To solve this issue, add the following at the end of apache config file, httpd.conf

<IfModule mpm_winnt_module>
    ThreadStackSize 8888888
</IfModule>

AND restart apache. i take this solution from this site.

5
  • 1
    i added this module to httpd.conf and it problem gone ... again i removed the module and now everything is ok :D
    – mostafaznv
    May 17, 2016 at 23:13
  • 1
    Issue fixed after increasing the ThreadStackSize setting to 8m. Apache 2.4 and PHP 7 on Windows. I'm just a bit concerned whether 8m is a bit too much on high traffic pages, but that's a thing everyone can experiment with.
    – Anse
    Sep 13, 2016 at 5:41
  • For me, even this did not help. But the error went away after I added an empty newline in my PHP code. Go figure... May 8, 2019 at 12:52
  • 1
    Thanks! I was having problems when using xDebug the connection would keep resetting.
    – antman3351
    Jun 9, 2020 at 12:04
  • 1
    9 years and this saved me! Thank you!
    – Mo-
    Feb 1 at 2:03
7

I found a solution that worked for me.

I copied the following two files from my PHP directory to the Win32 directory and the errors stopped : php5apache.dll, libmysql.dll.

So even though these files should have been found in the PHP directory under certain circumstances they needed to be in the system dir

4

In my case it was the php extension APC (php_apc.dll, 3.1.10-5.4-vc9-x86, threadsafe), which caused the error.

I used XAMPP 1.8.2 with PHP 5.4.19 and Apache 2.4.4

Since it could be caused by another extension as well, it might be a good starting point to restore the original php.ini from the xampp distribution. If this one works well, try to change it line by line to your desired configuration (starting with the extension list).

2

We are running two copies of Apache, each with their own version of PHP.

After searching for this error and trying different suggestions of copying files into the windows system32 folder, I finally found that the issue seems to be multiple copies of libmysql.dll found in the windows path.

After copying the libmysql.dll file into the apache bin folder we no longer have this problem.

2

I had the problem - and after checking my folders, I realized I did not have the php5apache.dll in my php directory. So I tried copying it from the Win32 folder - and it has improved matters considerably (I won't hold my breath yet :))

0
2

I just had this problem for a while, apache restarted in every 5-15 minutes. My server serves a lot of sites and a portal with a big traffic, I programmed that portal and I just figured it out that the get_browser() function gives a memory error sometimes (depends on the agent). I refreshed the browscap.ini, no effect, the restarting still happens but as far as I removed to use this function, the apache didn't restart anymore. I use PHP 5.2.6 with Apache 2.0.5x I hope this helps for some other people too.

2

So my php directory did not have libmysql.dll in it this seems to have resolved the problem.

I also added this to the win32 directory and the apache bin directory

1

I experienced tha same problem when I called

$link = mysql_connect('127.0.0.1', $user, $password);

from a PHPscript when running a clean install of WampServer (http://www.wampserver.com/en/)

I tried to copy DLLs, as suggested above, but I could not get it to work.

Finally I changed to UniformServer (http://www.uniformserver.com/) 5.6.16, and it worked as a charm.

Hope this post can save some time for somebody :-)

1

I tried above, but they all did not work.

After long investigation, it was ridiculously easy: in one of my ajax-files I had in the PHP-code the line

mysqlclose();

This was the problem. Everything works fine now.

Just mentioning. Maybe helping people cut their debugtime a bit.

1
  • 1
    do you mean mysql_close(), or literally mysqlclose() ? Jun 8, 2012 at 18:15
1

This is an openssl_public_encrypt() function in my case.

1

I had this same problem. Copying dll's didn't fix it. So I looked around some more and found this thread with the answer that worked for me. Why does my XAMPP Apache service keep restarting?

In my Nvidia control panel I didn't see the FIrstPacket settings initially, so I uninstalled the Nvidia ForceWare Network Access Manager, then reinstalled it through the Nvidia drivers. After the restart the FirstPacket settings were visible and I made sure it was disabled, then everything worked.

1

It is a problem with a problematic mix of mysql DLLs. See here for a solution: http://www.java-samples.com/showtutorial.php?tutorialid=1050

Copying dlls into system32 is not the best thing to do, so I suggest to install apache+php+mysql properly, rather than copy files into system32, because once the dlls are there - they will be loaded instead of newer version dlls, in a future update.

0

Copy file php5apache.dll from xampp\php\ to Windows\System32\

0

It looks like after some Windows update, this issue may appear if you have open_basedir set, as well. This was discovered by me in https://www.apachelounge.com/viewtopic.php?p=39993
For me commenting out open_basedir resolved the issue and sped up the site significantly.
I plan to look further into it and report it as bug, if applicable. Will update this answer with any news.

Reported as https://bugs.php.net/bug.php?id=80881

0

I also encountered this problem when upgrading PHP from 8.0 to 8.1 on a Windows 11 Apache 2.4.49 installation from Apache Lounge. None of the other solutions resolved my issue; however I did get a hint from this thread on laracasts and on checking my PATH variable realised that it was still pointing at PHP8.0. Once I updated the PATH to point to PHP8.1 and rebooted the computer (simply restarting Apache did not help), the problem was resolved.

Not the answer you're looking for? Browse other questions tagged or ask your own question.