3

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?

1

3 Answers 3

7

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
Sign up to request clarification or add additional context in comments.

3 Comments

I had the exact same problem as OP. This solution fixed the issue on my side.
I can confirm that this solution fixed the problem for me.
Just worked for me as well after Ubuntu upgrade from 20.04 to 22.04
1

Finally it was php 8.1 which cause this issue. Before the upgrade I had php 7.4 and everything was fine, so I removed php 8.1

Comments

1

April 2024, upgrading 20.04 ubuntu to 22.04.4 ubuntu, problem still present, all php applications broken (wiki, pbp, etc..)

/etc/apache2/mods-enabled# ln -s ../mods-available/php8* . 

fixed it

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.