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.
- My file has a php extension (and ini file is configured to read ".php" files)
- 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"
httpd -t
turns just fine- And so does
php -v
- My php.ini file has been "uncommented" as the 1st webpage I refer suggests
- 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").
Thanks!!
EDIT:
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.
EDIT2:
Here are the versions I am using:
PHP 7.3.9 (TS) x64 Apache 2.4.41 x64
EDIT3:
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.
LOGS:
[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 threads.
[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
phpinfo()
test in a php file and sure enough, nothing shows, just a blank page. I'll edit my question adding this info too!