Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jlrdw's avatar
Level 75

PHP 8.1 problems with Apache [Solved]

I have been upgrading all my development to php 8.1. Nginx is working fine.

But apache is doing the following:

The connection to the server was reset while the page was loading.

And in the error log:

AH00428: Parent: child process 2160 exited with status 3221225477 -- Restarting.

I have tried the solution here: https://laracasts.com/discuss/channels/code-review/laravel-8-with-php-81-on-apache-server?page=1&replyId=751753

The version I have is: PHP 8.1 (8.1.0) VS16 x64 Thread Safe (2021-Nov-23 22:35:04)

I went back one version: PHP 8.0 (8.0.13) VS16 x64 Thread Safe (2021-Nov-16 22:28:26)

And with the 8.0.13 all works with no errors in the log.

And I have triple checked my conf and ini files they are correct. Any ideas, or do you think 8.1 has a bug.

Thanks

0 likes
39 replies
khatabwedaa's avatar

You have to go to the PHP installation folder and look for libmysql.dll file and copy this file and save it to your windows\system32 folder. then restart your Apache and MySQL and I hope it will work fine.

jlrdw's avatar
Level 75

@khatabwedaa Thanks for the reply, I have used many zip versions of apache and php over the years but never had to copy that file. But tried it and still same error. I did reboot the computer also.

1 like
jlrdw's avatar
Level 75

@Tray2 it's on Windows 11 development. And prior version php 8.0.13 works, jst getting problems with 8.1.

Tray2's avatar

@jlrdw Have you updated your httpd.conf

LoadModule php_module "C:/php/php8apache2_4.dll"

jlrdw's avatar
Level 75

@Tray2 yes I have:

PHPIniDir "D:/programs/php"
LoadModule php_module "D:/programs/mywamp/php/php8apache2_4.dll"
AddType application/x-httpd-php .php

And in the 8.0.13 version, I went to all works. Just the 8.1 problems.

EDIT

I even tried the version from QA Releases, PHP 8.1 (8.1.1RC1) but still an error, this time:

PHP Warning:  PHP Startup: fileinfo: Unable to initialize module\nModule compiled with module API=20210902\nPHP    compiled with module API=20200930\nThese options need to match\n in Unknown on line 0

And several others similar, it's as though the extensions aren't working but they are uncommented.

jlrdw's avatar
Level 75

@Tray2 I saw that one, I am beginning to think there's an unfixed bug in the 8.1 thread safe version.

The 8.1 non thread safe version works fine with nginx.

Tray2's avatar

@jlrdw That is a possibility. I will give it a go on my Windows 10 machine tonight and see if I get the same thing.

jlrdw's avatar
Level 75

@Tray2 yes that's the install steps I use, and like I said php 8.0.13 with same apache works perfect.

However this machine is Windows 11 which shouldn't make a difference, but later I'm going to boot up a Windows 10 machine and give it a try.

Did you use rc1?

jlrdw's avatar
Level 75

@Tray2 I also have the non thread safe version working, but the NTS is used with nginx, all is working good with nginx.

Apache needs thread safe.

Edit:

I setup same on a windows 10, same errors. However the php 8.0.13 still worked perfect.

Tray2's avatar
Tray2
Best Answer
Level 73

@jlrdw You are correct, I meant the thread safe version.

I did this on my machine.

#1. Downloaded the httpd-2.4.51-win64-VS16.zip from Apache Lounge

#2. Unzip it to C:\Apache24

#3. Download php8.1 Thread safe from [windows.php.net(https://windows.php.net/download)

#4. Unzip it to C:\php8.1

#5. Add these lines to the end of httpd.conf

# PHP 8.1 module 
PHPIniDir "C:/php8.1"
LoadModule php_module C:/php8.1/php8apache2_4.dll
AddType application/x-httpd-php .php

#6. Add index.php to the DirectoryIndex

<IfModule dir_module>
	 	DirectoryIndex index.php index.html
</IfModule>

#7. Test the config (As administrator) with `httpd -t``

#8. Start Apache (As administrator) with httpd

#9. Create index.php and add

<?php phpinfo();

#10. Browse to localhost

2 likes
jlrdw's avatar
Level 75

@Tray2 did you uncomment

Include conf/extra/httpd-mpm.conf

Tray2's avatar

@jlrdw No, I didn’t. I can do that when i get home from work and test again.

1 like
Tray2's avatar

@jlrdw I uncommented that line and it still works fine.

1 like
jlrdw's avatar
Level 75

@tray2 I am still having problems, but will continue researching.

Did same setup with 8.0.13 version all worked perfect.

Tray2's avatar

@jlrdw That is very strange. Have you tried to download php and apache again and placed then in other directories?

1 like
jlrdw's avatar
Level 75

@Tray2 yes on the Windows 10 machine.

I tried the 8.1 first, same errors, then tried the same with 8.0.13, and no errors all worked.

Even added to path and rebooted.

But like I said the non threaded version works with nginx perfect.

Apache was fine, I get the it works.

It's something with the 8.1 php I'm missing. Even reinstalled the vs files required, vc_redist_x64 link.

jlrdw's avatar
Level 75

@Tray2 Also I did further testing:

WIth php 8.1, I cannot get it working with apache on windows without errors like:

[mpm_winnt:notice] [pid 6788:tid 740] AH00428: Parent: child process 3500 exited with status 3221225477 -- Restarting.

But no errors using php 8.0.13

However, apache itself works, and the php 8.1 built in server works. The two just won't work together. I even tried enabling some of the commented zend extensions.

jlrdw's avatar
Level 75

I never got the php 8.1 64 bit working, I decided to try the x86 version php-8.1.1RC1-Win32-vs16-x86 and it worked fine.

So still don't know why my machine:

  • 8.0.13 64 bit works
  • 8.1 x86 works
  • 8.1 64 bit constantly restarts and has errors

Like : [mpm_winnt:notice] [pid 6788:tid 740] AH00428: Parent: child process 4304 exited with status 3221225477 -- Restarting.

Edit

Also did the 8.1 x86 version on Windows 11, worked with no problems, so both my WIn 10 and 11 machines just don't want to work with the newer 64 bit versions.

Tray2's avatar

@jlrdw If it was just one machine, I'd say you have memory issue, but since it's two different machines that isn't likely. Just a shot in the dark, what happens if you turn off the anti-virus software?

1 like
jlrdw's avatar
Level 75

@Tray2 getting late, I will try tomorrow. Weird that 8.1 64bit works with nginx and the 8.1 x86 works.

I even tried all three the one from download page and both from the QA Releases page.

But the built in server did work in the 8.1 64 bit version. I can normally setup a mariadb, php, apache combo faster than a container, just a few minutes.

I haven't encountered such errors prior. Been setting this stuff up for years. Of course new to nginx, but so far it's been pretty easy to work with thanks to help from you and others here.

MichaelPritchard's avatar

@jlrdw are you downloading the windows Thread Safe version? You need 8.1 64-bit Thread Safe (TS) for Apache.

Which version do I choose?

IIS

If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions of PHP.

Apache

Please use the Apache builds provided by Apache Lounge. They provide VC15 and VS16 builds of Apache for x86 and x64. We use their binaries to build the Apache SAPIs. With Apache, using the apache2handler SAPI, you have to use the Thread Safe (TS) versions of PHP.

jlrdw's avatar
Level 75

@MichaelPritchard thanks for reply. Yes I have correct version, the 8.0.13 works perfect. Just cannot figure out the errors in the 8.1 64 bit yet.

As I said, the built-in server works, I just cannot get that version working happily with Apache.

MichaelPritchard's avatar

@jlrdw I've tried some experiments with PHP 8.1 64-bit Thread Safe with Apache 2.4.51 64 bit. Everything works until I open Laravel, then all I can get is This site can’t be reached!

  • PHP 7.4 works with Laravel 8 (Laravel v8.75.0 (PHP v7.4.19))
  • PHP 8.0 works with Laravel 8 (Laravel v8.75.0 (PHP v8.0.12))
  • PHP 8.1 works with Laragon home page and phpinfo(), but not with Laravel 8, I get This site can’t be reached The connection was reset.
jlrdw's avatar
Level 75

@tray2 I did try with av off.

Latest error is:

Unable to load dynamic library 'gd'

Same error for all libraries, i.e., mbstring etc.

MichaelPritchard's avatar

My error was logged in the Apache log file:

[Thu Dec 09 18:57:54.599662 2021] [mpm_winnt:notice] [pid 26464:tid 552] AH00428: Parent: child process 23404 exited with status 3221225725 -- Restarting.

The fix was found codexpedia.com - Parent: child process exited with status 3221225725 — Restarting on XAMP apache

The fix was to create a file httpd.conf in c:\laragon\etc\apache2\

<IfModule mpm_winnt_module>
	ThreadStackSize 8888888
</IfModule>

Restart Apache.

Laravel 8 now works with PHP 8.1 in Apache 😀 (Laravel v8.75.0 (PHP v8.1.0))

1 like
jlrdw's avatar
Level 75

Okay, I got it working. In the path was listed C:\xampp\php several lines above where I added

D:\programs\php. Don't worry @tray2 I will go in the back yard and do some yelling.

Thank you everyone who replied. Sometimes it's a little overlooked thing. Still funny how the 8.1 x86 worked right away.

1 like
jlrdw's avatar
Level 75

@Tray2 I appreciate your and others help so much.

2 likes
ktscript's avatar

I wandered here in search of help connecting php 8 + apache on > win10. Yes, the recipes above work, but one "but". Only builds 8.0.x and 8.1.x have this library php8_apache2.dll . At the time of writing this post, all the builds above the version do not have this library. Therefore, we do not get lost and download past releases in which it is.

Please or to participate in this conversation.