A PHP project with a database — the kind built across this site's PHP and SQL courses — needs one more piece than a static site: a real, live database on the server, not just uploaded files.
Shared hosting, per the choosing-hosting-for-your-stack lesson — it is built around exactly this combination. You'll use the control panel's file manager or FTP for the code, and its database tools for the database itself.
.sql file exported from your local development database.public_html.Local and live database credentials are always different
Your local development database and your live server's database are two entirely different databases, with different connection details — a different host, username, password, and often a different database name entirely. Code that worked locally will fail on the live server until the connection details in your code are updated to match the live database's actual credentials, not your local ones.
// A pattern worth using specifically to avoid this trap —
// keep credentials in one place, changed once per environment,
// rather than hardcoded and forgotten in multiple files
$host = 'localhost'; // usually correct on shared hosting itself
$dbname = 'youraccount_dbname'; // shared hosts often prefix this with your account name
$username = 'youraccount_dbuser';
$password = 'the-password-you-set-when-creating-it';Shared hosts commonly prefix both the database name and username with your account name — a detail that trips up students expecting the exact name they typed when creating it.
| Symptom | Likely cause |
|---|---|
| A blank white page | A PHP error with error display turned off — check your host's error log |
| "Access denied for user" | Wrong database username or password in your connection code |
| Site loads but no data appears | Database imported but empty, or connected to the wrong database name |
| Works on some pages, not others | A specific query or table missing from the imported database |
Per this category's pipeline standard: check that a page reading from the database actually shows real data, that a form writing to the database actually saves something (check it in phpMyAdmin afterward), and check your host's error log for anything unexpected — most control panels expose this directly.