How to put your PHP and MySQL assignment online
You have a PHP page, a MySQL table and a bit of JavaScript, and a deadline. This walk-through puts all of it on an awx computer and gives you a link that keeps working for as long as the computer is on. Every screenshot is from a real computer.
What we are building
A class notes board. A form takes a note, PHP saves it in a MySQL table, and the page lists the latest notes. A few lines of JavaScript keep the Add button switched off until you type something. It is small on purpose: the same steps work for a bigger assignment. A live copy is running at classnotes.awanbox.com if you want to see where we end up. It is read-only, so nobody can change it.

1. Make a computer
On the Computers page press New computer. The smallest size is enough for PHP and MySQL. Every size has a desktop with Chrome, which is handy if you want to test in the computer's own browser; the larger ones run it more smoothly. The box Keep it running until my credit runs out can wait until the end; we come back to it in step 8.

2. Install PHP and MySQL
Open the computer and go to the Terminal tab. You are signed in as a normal user that can use sudo. PHP and MySQL are not installed, and one command adds them:
sudo apt update
sudo apt install -y php php-mysql mariadb-server
The install takes a minute or two. The package is MariaDB, the free drop-in version of MySQL: the commands and the PHP code are the same, and for an assignment you will not see a difference. Then start the database and check that everything answers:
sudo service mariadb start
php -v
mariadb --version
3. Create the database
Type sudo mariadb to open the database prompt and paste this. It makes a database, a user that can only touch that database, and one table.
CREATE DATABASE school;
CREATE USER 'student'@'localhost' IDENTIFIED BY 'pick-your-own-password';
GRANT ALL ON school.* TO 'student'@'localhost';
USE school;
CREATE TABLE notes (
id INT AUTO_INCREMENT PRIMARY KEY,
text VARCHAR(200),
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
Choose your own password instead of the one in the example, and do not reuse a password you use anywhere else. The database only answers to programs on this computer, so the only thing that can reach it is your PHP code.
4. Add your code
Put your files in a folder, say /home/agent/site. You can upload them from your laptop in the Files tab, write them in the terminal, or ask the built-in agent in the chat to write a first version and then read what it wrote. This is the whole page for the board:
<?php
// Class notes board: PHP + MySQL (MariaDB) + a little JavaScript.
$db = new mysqli("localhost", "student", "change-me", "school");
if ($_SERVER["REQUEST_METHOD"] === "POST" && trim($_POST["text"] ?? "") !== "") {
$stmt = $db->prepare("INSERT INTO notes (text) VALUES (?)");
$text = substr(trim($_POST["text"]), 0, 200);
$stmt->bind_param("s", $text);
$stmt->execute();
header("Location: /");
exit;
}
$rows = $db->query("SELECT text, created_at FROM notes ORDER BY id DESC LIMIT 20");
?>
<!doctype html>
<title>Class notes</title>
<form method="post">
<input name="text" id="t" maxlength="200" placeholder="Write a note for the class">
<button id="b" disabled>Add</button>
</form>
<ul>
<?php while ($row = $rows->fetch_assoc()): ?>
<li><?= htmlspecialchars($row["text"]) ?> <small><?= htmlspecialchars($row["created_at"]) ?></small></li>
<?php endwhile; ?>
</ul>
<script>
const t = document.getElementById("t"), b = document.getElementById("b");
t.addEventListener("input", () => { b.disabled = t.value.trim() === ""; });
</script>
Two habits in there are worth keeping for your own work. The note goes into the database through a prepared statement (prepare and bind_param), so what a visitor types can never rewrite your SQL. And everything that goes back onto the page is passed through htmlspecialchars, so a note that contains HTML shows up as text and does not run.
5. Run it
PHP can serve a folder by itself, which is fine for an assignment. Start it on port 8000:
php -S 0.0.0.0:8000 -t /home/agent/site
Leave that running while you try the page. In step 8 we hand the job to awx so you do not have to babysit it, and we will stop this copy first, because two programs cannot share one port.
6. Get a public link
Open the Previews tab. Under Share a web server enter the port, 8000, choose how long the link should work, and press Create link. The address appears in a box. Copy it and press Done. You can see it again later under Active links.
A new link lasts from one hour to seven days, which is right for a quick demo. For a link that should not expire while you are marking, press Keep always next to it in Active links. It then works until you press Revoke. The date the page shows afterwards is years away, and that is expected.
7. Give it a name people can type
A random address is hard to read out in a lab. Under Custom names pick a short name and the port, and you get an address such as myassignment.awanbox.com. It has no expiry: it stays until you remove it. You can have three, and names that look like part of awx itself, such as www or admin, are refused.
Here is one that is real. This page runs on a small awx computer and answers to its own custom address. It was made by following these steps, and it stays up the way step 8 describes.

8. Keep it up while the computer is on
Two things can make the page disappear: the computer going to sleep, and the program stopping. Both have a setting.
Sleep. An awx computer goes to sleep after 30 minutes without activity, and a visit to your link counts as activity. A quiet link at three in the morning does not. Under Settings, Power, tick Keep it running until my credit runs out (on the paid plan it reads Never stop it for being idle), and the computer stays on until you stop it or your credit is gone. More in why a computer sleeps, and how to keep it running.
The program. If your PHP server or your database stops, so does the page. On the Previews tab the Services card keeps a command running for you. First stop the copies you started by hand: press Ctrl+C in the terminal where PHP is running, and type sudo service mariadb stop. Then add the web server and the database as two services:
web php -S 0.0.0.0:8000 -t /home/agent/site
db sudo mysqld_safe --user=mysql
If a service stops, it starts again a few seconds later, and both come back by themselves whenever the computer starts. We tested this: we stopped the computer, started it again, and eight seconds later the page was serving its notes. The notes were still there because the database lives on the computer's disk. Use the same Keep this computer awake option on the service to get the same effect as the Power setting.
9. What your lecturer sees
They open the address on whatever they have: a laptop, a phone, the lab PC. There is nothing to install and nothing to configure.

Before you send the link
- Open it in a private window, the way a stranger would, and check that it works.
- Try it on your phone as well. A lecturer is as likely to open it there.
- Keep passwords out of your code. Put them in one config file, and do not paste that file into a chat or a forum.
- Delete test notes, and leave out anything personal. The page is public.
- Do not put phpMyAdmin or another admin screen behind the link. Use the terminal for that.
A note on limits
The link works while the computer is on. If it is ever stopped, start it from the Computers page and the services come back. On the Free plan a computer that stays on uses credit every hour (Small is RM0.03 an hour, about RM22 a month), so keep it on only while you need the link. The paid plan runs for free.
New to awx? Why we think you can leave XAMPP behind is the short version of this post, and awx accounts are approved by hand for now, so sign in with Google and confirm your email first.
Keep reading
- How to back up and restore a cloud computer: a tested guide
- How to move a XAMPP project to AwanBox
- How to send your lecturer a link to your Flask assignment
- How to turn a weather API into a web page that stays up
- How to practise SQL with PostgreSQL: SELECT, JOIN, GROUP BY
- Dear students, do you still use XAMPP? Use Awanbox instead.
Awi, signing off.