skip to Main Content

I’m on Ubuntu 22.10 and I’ve done a standard apache and php install with

> sudo apt install apache2

and the default page appears at 127.0.0.1 on a browser. It works! Then I installed mySQL and starting it works

> sudo mysql
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 21
Server version: 8.0.31-0ubuntu2 (Ubuntu)
...

then

> sudo apt install php libapache2-mod-php php-mysql
> php -v
PHP 8.1.7-1ubuntu3.1 (cli) (built: Nov  2 2022 13:39:03) (NTS)
...

Now, I create an info.php

<?php
phpinfo();
?>

in /var/www/html/ and try to see it in my browser at 127.0.0.1/info.php and all I get back is the text itself

Obviously php is not engaging. Any ideas what I’m doing wrong?

2

Answers


  1. Chosen as BEST ANSWER

    Just found this post (ERROR: Module php7.0 does not exist!) and it works for 8.1. I followed the first, most popular answer (many others were similar) and restarted apache. Success.


  2. This work for me with ubuntu:22.04

    apt-get update
    apt -y install software-properties-common
    add-apt-repository ppa:ondrej/php
    apt-get update
    apt-get install -y apache2 libapache2-mod-php8.1
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search