Thapa Technical — Dev Blog
PHP MySQL Shared Hosting cPanel Hostinger

From XAMPP to Live Server
PHP + MySQL Hosting Guide.

You built your PHP MySQL project locally on XAMPP. Now it's time to make it live. This guide walks you through every step — from creating your database to uploading your files — no server knowledge required.

Why Shared Hosting Works for PHP

Unlike Node.js frameworks, PHP runs natively on virtually every shared hosting server. Providers like Hostinger, Bluehost, and GoDaddy all support PHP + MySQL out of the box — no extra configuration, no runtime to manage.

Technology Works on Shared Hosting What you need
PHP ✓ Native Upload .php files to public_html
MySQL ✓ Included Create DB via cPanel → phpMyAdmin
Node.js / Next.js ✗ Needs server Requires VPS or static export
Shared hosting plans starting at ~₹99/month on Hostinger are more than enough for a PHP + MySQL project. You get cPanel, phpMyAdmin, and File Manager included.

What You Need

Shared Hosting Plan (Hostinger / cPanel) Your XAMPP project folder MySQL database export (.sql file) DB config file (db.php / config.php)

Step-by-Step

01
Export your local database from XAMPP Open localhost/phpmyadmin, select your database, click Export, choose "Quick" format and download the .sql file. This is your full database backup.
02
Create a new database in cPanel Log in to your hosting cPanel → go to MySQL Databases → create a new database, a new user, set a strong password, and assign the user to the database with All Privileges.
03
Import your .sql file via phpMyAdmin In cPanel → phpMyAdmin, select your new database, click Import, choose your exported .sql file, and click Go. Your tables and data are now live.
04
Update your database config file Open your db.php (or wherever your DB connection is defined) and replace the local credentials with your live hosting credentials before uploading.
05
Upload your project via File Manager In cPanel → File Manager → navigate to public_html → Upload all your PHP project files here. Make sure index.php is at the root of public_html.
06
Test your live website Visit your domain in the browser. Check all pages, form submissions, and database queries. If something breaks, check the error log in cPanel → Error Logs under the Metrics section.

DB Config — Local vs Live

// Local XAMPP config $host = 'localhost'; $dbname = 'myproject'; $username = 'root'; $password = '';
// Live shared hosting config $host = 'localhost'; // usually still localhost $dbname = 'cpanelusername_dbname'; $username = 'cpanelusername_dbuser'; $password = 'your_strong_password';
On cPanel hosts, database and username names are prefixed with your cPanel account username (e.g., myaccount_dbname). Copy the exact names from the MySQL Databases page.
The host is almost always localhost on shared hosting — the database server runs on the same machine as the web server, just like XAMPP.

Common Errors & Fixes

!
Blank white page (500 error) Usually a PHP syntax error or wrong file path. Enable error display temporarily: add ini_set('display_errors', 1); at the top of index.php to see the actual error.
!
Access denied for user (DB connection fails) Double-check that the database user is assigned to the database in cPanel → MySQL Databases. Also verify the username/password in your config file match exactly — no extra spaces.
!
Images or CSS not loading (404) Check your file paths. Avoid absolute paths like C:\xampp\htdocs\... — use relative paths like ./css/style.css or root-relative paths like /css/style.css.
!
File permissions error If your app writes to files (uploads, logs), set folder permissions to 755 and file permissions to 644 via File Manager → right-click → Change Permissions.
Watch the Full Tutorial
Step-by-Step on YouTube

Watch the complete video walkthrough — from XAMPP to live server — on the Thapa Technical YouTube channel with 600k+ subscribers.

Watch on YouTube
Also check: /courses/backend/online-python-course.php — Python for backend devs