In this article · 10 sections
Your site works on localhost. Now it needs to go live. This guide shows how to deploy a PHP website to Hostinger shared hosting (the steps are similar on most cPanel/hPanel hosts).
1. Prepare locally
- Remove test files, debug code and
phpinfo()pages - Turn off
display_errorsfor production - Export your local database (phpMyAdmin → Export → SQL)
- Zip the project folder
2. Upload files
- hPanel → Websites → Manage → File Manager
- Open
public_html(the web root for your domain) - Upload the zip and Extract it
- Make sure
index.phpis directly insidepublic_html, not in a subfolder
You can also use FTP (FileZilla) or Git deployment if available.
3. Create the database
- hPanel → Databases → MySQL Databases
- Create a database, a user and a strong password (note the full names; they include a prefix like
u123456789_) - Open phpMyAdmin for that database and Import your SQL file
4. Update configuration
Edit your config/connection file with the live database name, user and password. The host is usually localhost. Keep this file out of public reach where possible and never commit real passwords to public Git repositories.
5. Domain and SSL
- If the domain is registered elsewhere, point nameservers or A record to Hostinger. See DNS records explained
- Enable the free SSL in hPanel and force HTTPS. See SSL guide
- Add redirects for www/non-www and clean URLs in
.htaccess. See .htaccess basics
6. PHP settings
hPanel → Advanced → PHP Configuration: choose a PHP 8.x version matching what you tested, and enable needed extensions (mysqli, gd, intl, etc.).
7. Email from the site
Shared hosts restrict PHP mail(). Use SMTP with PHPMailer. See PHP contact form with PHPMailer.
8. Go-live checks
- [ ] Home and inner pages load over HTTPS with no mixed content
- [ ] Forms submit and emails arrive
- [ ] Admin login works
- [ ] Images and CSS load (check paths are relative/correct case; Linux is case-sensitive)
- [ ] 404 page works
- [ ] Mobile view checked
- [ ] Google Search Console and sitemap submitted
- [ ] Backups enabled. See website backups
Moving an existing site?
See move website and domain to new hosting.
FAQs
Why does my site show a 500 error after upload?
Common causes: wrong PHP version, .htaccess rules not supported, or database credentials. Check error logs in hPanel. See debugging PHP errors.
Images work locally but not online. Why?
Linux servers are case-sensitive: Logo.png and logo.png are different files.
Was this article helpful?
Your answer helps us improve our guides