0

I haven’t coded PHP in 15 years, and I can't remember how to get started. I set up PHP 8.1 with apache2 on my Ubuntu 22.04 desktop, but I don’t recall how/where to set up my files and how to test them in a web browser. For example if I made a traditional hello.html (with php echo embedded) see below, how do I get it into my web browser to see if it works? It currently sits in my home folder.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>title</title>
    <!-- link rel="stylesheet" href="style.css" -->
    <!-- <script src="script.js"></script -->
  </head>
  <body>
    <!-- page content -->
        <?php
    phpinfo();
    ?>
  </body>
</html>
karel
  • 114,770

1 Answers1

0

Put it in /var/www/html, start your apache server (sudo systemctl start apache2), and then visit http://localhost/hello.php.

Emoji
  • 577