0

can't get PHP running on apache, having run these commands to set up apache with php

I have an ubuntu machine, and have been trying to get PHP running..

As you can see the PHP isn't running

root@ubuntu:/etc/apache2# cat /var/www/html/index.php
<?php
echo 4+3;
?>
xyz
root@ubuntu:/etc/apache2#

root@ubuntu:/etc/apache2# curl 127.0.0.1/index.php <?php echo 4+3; ?> xyz root@ubuntu:/etc/apache2#

I tried apt-get update , apt-get upgrade, apt-get purge apache2 , apt-get install apache2, apt-get install php libapache2-mod-php , systemctl restart apache2

Still same result.

barlop
  • 125

1 Answers1

1

PHP must be enabled in Apache. Run

sudo a2enmod php7.4  # or whatever version of libapache2-mod-php7.X is installed

and restart Apache.

FedKad
  • 13,420