Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP not running after Upgrade Ubuntu

Tags:

php

ubuntu

I have upgraded my Ubuntu server to 22.04.1. Everything else is working fine but php simply does not run! I tried to visit my website and all I get is php source code. For example, mydomain.com/info.php shows me the code:

<?php
phpinfo();
?>

I restarted all apache services - nothing changed! php -v on terminal shows this (everything OK):

PHP 8.1.2 (cli) (built: Jul 21 2022 12:10:37) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.2, Copyright (c) Zend Technologies with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

Any idea?

like image 397
user3513782 Avatar asked Jan 30 '26 05:01

user3513782


1 Answers

You could also just have added the symlinks to /etc/apache2/mods-enabled for the php8.1.load and php8.1.conf files found in /etc/apache2/mods-available

  1. cd /etc/apache2/mods-enabled
  2. ln -s ../mods-available/php8.1.load php8.1.load
  3. ln -s ../mods-available/php8.1.conf php8.1.conf
  4. restart apache
like image 192
zangtong Avatar answered Feb 01 '26 19:02

zangtong