Windows – Apache 2.4 not running PHP 7 (windows)

apache-http-serverPHPwindows 10

I have apache installed. I was doing just fine until today, that I created a php file and so apache did not open it.
I then searched the web and I realized I needed to install php (I come from Linux so I never needed to do this).
I followed some tutorials (here, and here), but none of this work.
I have researched a bit so I can outright discard the most common things, that I list below.

  1. My file has a php extension (and ini file is configured to read ".php" files)
  2. Apache "httpd-conf" file is modified as follows:

# PHP7 module
LoadModule php7_module "C:/php/php7apache2_4.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

  1. httpd -t turns just fine
  2. And so does php -v
  3. My php.ini file has been "uncommented" as the 1st webpage I refer suggests
  4. I already added the environment route to my PC

So, any clue? Something is wrong with what I've done? Can it be a matter of installing Apache BEFORE php? That's the only thing I can think of, after researching and trying every fix suggested in this and other websites, is the only "logical" explanation I can think of (besides forgeting something not as common or following the wrong "tutorial").



I suspect something is wrong because apache is only displaying code when I'm loading some php file. If my php code contains some html, this one is correctly displayed but not the php part (I checked for syntax issues among the php code and turned just fine).

Later I decided to try loading the following:

<? php phpinfo(); ?>

On an index.php file (I tried using a different name and specifying it as localhost/test.php) but is just displays a blank page.


Here are the versions I am using:

PHP 7.3.9 (TS) x64
Apache 2.4.41 x64


Downgraded to PHP 7.2.22, still not working. I did some changes as suggested on various websites (basically adding things to the httpd-conf file), and checked for syntax as previously. Still none of this worked. I tried to start apache and load the "localhost" page with my index.php (the test script) on it and check for the logs in hope of finding some issue. As I'm no expert I would say logs turned just fine, but I paste them in here just in case someone notices anything weird.


[Wed Sep 04 10:40:34.234726 2019] [mpm_winnt:notice] [pid 7276:tid 768]

AH00455: Apache/2.4.41 (Win64) PHP/7.3.9 configured — resuming normal operations

[Wed Sep 04 10:40:34.234726 2019] [mpm_winnt:notice] [pid 7276:tid 768]

AH00456: Apache Lounge VS16 Server built: Aug 9 2019 16:46:32

[Wed Sep 04 10:40:34.234726 2019] [core:notice] [pid 7276:tid 768] AH00094:

Command line: 'C:\Apache24\bin\httpd.exe -d C:/Apache24'

[Wed Sep 04 10:40:34.234726 2019] [mpm_winnt:notice] [pid 7276:tid 768]

AH00418: Parent: Created child process 8232

Apache server shutdown initiated…

pm_winnt:notice] [pid 8232:tid 784] AH00354: Child: Starting 64 worker

[Wed Sep 04 10:41:33.635398 2019] [mpm_winnt:notice] [pid 7276:tid 768]

AH00422: Parent: Received shutdown signal — Shutting down the server.

[Wed Sep 04 10:41:35.666154 2019] [mpm_winnt:notice] [pid 8232:tid 784]

AH00364: Child: All worker threads have exited.

[Wed Sep 04 10:41:35.681785 2019] [mpm_winnt:notice] [pid 7276:tid 768]

AH00430: Parent: Child process 8232 exited successfully.

The "– Shutting down the server."" was me closing the application at 10:41 AM

Hope this is useful

Best Answer

As a thought, you may wish to consider verifying your version of PHP is suitable for your version of Apache. This might include:

  • Verifying both PHP and Apache were compiled with compatible compilers.

  • Verifying both were compiled in 32-bit or 64-bit formats.

  • Make sure that your are using a Thread Safe (TS) versions of PHP.

  • Considering downgrading or otherwise switching versions if you are using an early version of 7.4 (up to and including 7.4.0beta2).


The log information shows you are running an Apache Lounge build of Apache, which is compatible with PHP 7.3.9 for certain.

I tried to do the phpinfo() test in a .php file and sure enough, nothing shows, just a blank page.

This is typical of syntax errors with PHP. Looking back over your original post, your <? php phpinfo(); ?> command should be <?php phpinfo()?>. Running <? php phpinfo(); ?> with a known, working PHP installation (Apache Lounge Apache v2.4.41 VS16 x32 with PHP 7.3.9 VC15 TS x32) yielded a blank page as well.