Laravel showing code of index.php on home page
add below command :
sudo apt-get install libapache2-mod-php7.2
(this will pull the default PHP version)
Reload Apache configuration changes by restarting service using below command
sudo service apache2 restart
I ran into same issue and was looking for answers. In my case I had multiple versions of PHP installed with all necessary libraries, including the one mentioned in answers above.
The cause of issue turned out to be not properly switching between PHP, which I do time to time while switching projects. Running again a2dismod php5.6
and then a2enmod php7.3
(switch from php5.6 to php7.3) and restarting apache did the job for me.
Hope this helps someone with similar issue like mine.