I am experiencing an issue with Apache not displaying my PHP code. I have Apache and PHP installed on my system, and I was using them without issue until I created a PHP file. When I tried to open the file with Apache, it did not work.

I searched online and learned that I needed to install PHP (I am used to using Linux, so I had not needed to do this before). I followed some tutorials, but none of them resolved the issue.

I have checked several things to try and troubleshoot the problem:

  • I made sure that the file has a .php extension and that the ini file is configured to read .php files.
  • I modified the Apache httpd.conf file to include the correct PHP module and AddType directive.
  • I confirmed that both Apache and PHP are running properly.
  • I uncommented the PHP ini file as instructed in one of the tutorials.
  • I added the environment route to my system.

Despite these efforts, I am still having issues with Apache not displaying my PHP code. When I use the PHP function phpinfo(), it shows a blank page. I have tried using a different version of PHP, but the issue persists.

I have also tried adding various directives to the httpd.conf file and checking for syntax issues, but none of these actions have resolved the issue. When I start Apache and load the localhost page with my PHP script, the logs seem normal.

The versions I am using are PHP 7.3.9 and Apache 2.4.41.

Askify Moderator Edited question May 4, 2023