I updated my Ubuntu from 19.04 to 19.10. Now the Apache PHP is not working. All I get is the raw PHP code instead of the rendered PHP. How can I fix this?


2 Answers 2


upgraded the other day and found the same issue today when I went to start writing some PHP. My solution was this:

sudo apt update; sudo apt remove php -y; sudo apt remove apache2 -y; sudo apt autoremove -y

This will uninstall apache2 and php, then we need to reinstall:

sudo apt install apache2 -y; sudo apt install php -y;

Then you are going to need to enable php (this may be the only step you need to do)

sudo a2enmod php7.x

*Note X is for your version of PHP (As of my writing installing php will install 7.3). Also note that you may not need to uninstall apache2/php and then reinstall. This is how I did it before I enabled PHP again. Hope this helps.

  • Thanks Alex. That fixed it! :)
    – Saqib Ali
    Nov 7, 2019 at 14:44

I had the same issue I just ran sudo a2enmod php7.3 and it worked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .