I'm running trying to run php7.4 on an Apache2. For some reason, when I try to run any use any php scripts in my code, they do not run, and all that is shown is the comment.
What I have in my code is this:
<?php
include("developers.php");
?>
However, what shows up on the html source when loaded in a browser is this:
<!--?php
include("developers.php");
?--!>
I've tested this with multiple different scripts, so I do not believe that it is any issue with the php itself. I also installed php7.4, as well as libapache2-mod-php7.4. I also enabled the php7.4 module in apache2.
Furthermore I have tried multiple different .htaccess
and apache2.conf
configurations, including adding
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
and
<FilesMatch "/.php$">
SetHandler application/x-httpd-php
</FilesMatch>
I noticed that when I did not include the <FilesMatch>
tags, then the php code will run, however then the page itself breaks, and the javascript and css on my page does not run properly.
I also commented out this section in the php7.4.conf
:
# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#<IfModule mod_userdir.c>
# <Directory /home/*/public_html>
# php_admin_flag engine Off
# </Directory>
#</IfModule>
I am running my server on Debian 11, if that helps.
Can anyone help me with this?
NOTE: This question was originally on StackOverflow, however I was told by a user there to repost it here, as it is offtopic for StackOverflow.
Also none of
https://stackoverflow.com/questions/12828163/why-are-my-php-tags-converted-to-html-comments
https://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-but-the-code-shows-in-the-browser-source-code
PHP not being parsed in apache2, php module is installed and enabled
answer my question.
I found several other answers to similar questions as well, which I won't link here due to not being able to find all the links now, but I couldn't find anything of use.