How to Deploy a PHP Project to a Live Server – Complete Beginner’s Guide 2026

CS Student Productivity Deploy PHP Live Server 2026 cPanel FileZilla FTP Database Migration Free Hosting
CS Student Productivity & Tools — 2026

How to Deploy a PHP Project to a Live Server — Complete Beginner’s Guide 2026

Getting a live URL for your PHP project is the single biggest upgrade to your portfolio — and the step most students never take. This guide walks you through the complete process: choosing free hosting, uploading your files via FileZilla, migrating your database, and going live — step by step, with every common error solved.

🆓 Free hosting options 📁 FileZilla FTP guide 🗄️ Database migration 🐛 Error troubleshooter

Your project works perfectly on XAMPP. You can log in, navigate, add records, and export PDFs. But when a recruiter or interviewer asks “can I see it running?” — you have to say no, because it only exists on your laptop. A live URL changes everything.

“Live demo: https://hospital-demo.infinityfree.net” on a CV turns a description into evidence. A recruiter who can click and see your system running in 30 seconds is significantly more impressed than one reading “I built a hospital management system in PHP.” This guide gets you from XAMPP to live server in one afternoon.

Your goal by the end of this tutorial:

https://yourproject.infinityfree.net
A real, public URL you can put on your CV and share with anyone in the world
1Choose Hosting
2Prepare Files
3Upload via FTP
4Migrate Database
5Fix Config File
6Test & Go Live

Step 1 — Choose Your Free Hosting

For student portfolio projects, you do not need paid hosting. These options are genuinely free with no credit card required and support PHP + MySQL — exactly what Codezips projects need:

HostURL FormatPHPMySQL DBsStorageBest For
InfinityFree ⭐ Recommended yourname.infinityfree.net PHP 8.2 Unlimited 5GB Management system projects, most Codezips downloads
WebHostMost yourname.webhostmost.com PHP 8.1 Unlimited 1GB Simple PHP projects, fast setup
000webhost yourname.000webhostapp.com PHP 7.4 1 DB 300MB Very small test projects only
Railway.app yourname.up.railway.app Any version Included 5GB Slightly technical — better for developers comfortable with Git
Hostinger (paid) yourdomain.com PHP 8.3 100 DBs 100GB Professional portfolio — ~£2/month, worth it for job applications

This tutorial uses InfinityFree — it is the most reliable free option for PHP/MySQL projects, has cPanel, and your site stays up 24/7. Sign up at infinityfree.com (no credit card required). After creating an account and a hosting account, you get access to a cPanel dashboard.


Step 2 — Prepare Your Project Files for Upload

Before uploading anything, do four things to your project files on your local machine:

2a — Remove your database credentials from the connection file

Your XAMPP config probably has username: root and password: (empty). The live server will have different credentials. You need to update the config file after you create the live database. For now, note where your credentials are stored.

Your typical XAMPP dbconnection.php — you will update these 4 values for live

<?php
// config/dbconnection.php
// XAMPP values (local):      → Live server values (you will fill these in Step 5)
$host     = 'localhost';      // stays 'localhost' on most hosts
$dbname   = 'hospital_db';    // → your InfinityFree database name
$username = 'root';           // → your InfinityFree DB username
$password = '';              // → your InfinityFree DB password

$conn = mysqli_connect($host, $username, $password, $dbname);
if (!$conn) {
    die('Connection failed: ' . mysqli_connect_error());
}
?>
⛔ Critical before GitHub upload: If your project is on GitHub, make sure dbconnection.php is in your .gitignore file. Pushing database credentials to a public GitHub repo is a serious security mistake. Add config/dbconnection.php to .gitignore and create a dbconnection.example.php with placeholder values instead.

2b — Export your database from phpMyAdmin

  1. Open XAMPP → click phpMyAdmin (or go to localhost/phpmyadmin)
  2. Click your project database in the left panel (e.g. hospital_db)
  3. Click the Export tab at the top
  4. Format: SQL — leave all other settings as default
  5. Click Export — this downloads a .sql file to your computer. Save it as database_export.sql

2c — Create a ZIP of your project files

Select your entire project folder (e.g. hospital_management/) and compress it to a .zip file. This makes uploading much faster than transferring files individually — especially useful for projects with many files.


Step 3 — Upload Your Files via FileZilla (FTP)

FileZilla is a free FTP client. Download it from filezilla-project.org. Your InfinityFree hosting account shows your FTP credentials in the cPanel dashboard under “FTP Accounts.”

  1. Open FileZilla. In the top bar: Host = your FTP hostname from InfinityFree (e.g. ftpupload.net), Username and Password = from your hosting dashboard, Port = 21. Click Quickconnect.
  2. In the right panel (remote server), navigate to the htdocs or public_html folder — this is where your website files must go.
  3. In the left panel (your computer), navigate to your project folder.
  4. Select your project ZIP file on the left, drag it to public_html on the right. Wait for the upload to complete (progress shows in the bottom panel).
  5. After uploading, right-click the ZIP in the right panel and look for an Extract option — or use cPanel File Manager to extract it (login to cPanel → File Manager → navigate to public_html → right-click the zip → Extract).
💡 Alternative to FileZilla: InfinityFree’s cPanel has a built-in File Manager tool. For small projects, you can upload files directly through the browser without needing FileZilla. Go to cPanel → File Manager → public_html → Upload. Use this if FTP is blocked on your university network.

Step 4 — Create and Migrate Your Database

This is the most important step. On InfinityFree you need to: (1) create a new database, (2) create a database user, (3) import your SQL file.

  1. In InfinityFree cPanel, click MySQL Databases
  2. Under “Create New Database,” enter a name (e.g. hospital) — note that InfinityFree prefixes it with your account ID automatically, giving you something like epiz_12345678_hospital
  3. Under “Create New User,” enter a username and password — note these down carefully
  4. Under “Add User to Database,” add your new user to your new database with All Privileges
  5. Now open phpMyAdmin from the cPanel dashboard
  6. Select your new database in the left panel
  7. Click the Import tab
  8. Choose your database_export.sql file and click Import
  9. Wait — you should see a green success message when done

Write down your live database credentials — you need them in the next step:

Your live database details — fill these in after creating the database

Host:     localhost  (almost always localhost — confirm in your cPanel)
DB Name:  epiz_12345678_hospital  (the full prefixed name InfinityFree gave you)
Username: epiz_12345678_youruser  (also prefixed)
Password: [the password you created in Step 4]

Step 5 — Update Your Config File on the Live Server

Now update the dbconnection.php on the live server with your live database credentials. Use FileZilla or cPanel File Manager to open and edit the file directly on the server.

Updated dbconnection.php — use your live database credentials here

<?php
// LIVE SERVER config — replace these with your InfinityFree database details
$host     = 'localhost';
$dbname   = 'epiz_12345678_hospital';  // ← your full DB name from cPanel
$username = 'epiz_12345678_youruser';  // ← your DB username
$password = 'YourSecurePassword123';   // ← your DB password

$conn = mysqli_connect($host, $username, $password, $dbname);
if (!$conn) {
    die('Connection failed: ' . mysqli_connect_error());
}
?>

Also check your file paths

On XAMPP your paths might start with C:/xampp/htdocs/project/. On a live server, absolute paths use /home/username/public_html/project/. Always use __DIR__ or relative paths in your PHP includes to avoid path issues:

Use __DIR__ for reliable paths that work on both XAMPP and live servers

// Bad — hardcoded path that breaks on live server:
require_once 'C:/xampp/htdocs/hospital/config/dbconnection.php';

// Good — relative path from current file:
require_once '../config/dbconnection.php';

// Best — absolute path using __DIR__ (works everywhere):
require_once __DIR__ . '/../config/dbconnection.php';

Your Deployment Checklist

✅ Before You Share Your Live URL — Verify Everything

Before Upload
Hosting Setup
Files Uploaded
Testing

Error Troubleshooter — Fix the Most Common Deployment Errors

⚠️ “Connection failed: Access denied for user” — blank page or database error
Cause: Your dbconnection.php still has XAMPP credentials (root / empty password) instead of live server credentials.
Fix: Open dbconnection.php on the live server via FileZilla or cPanel File Manager. Update all four values: host (usually localhost), database name (use the full prefixed name like epiz_12345678_hospital), username, and password. Save and refresh your site.
⚠️ Page loads but shows “include(): failed to open stream” or missing file errors
Cause: Your PHP include/require paths are hardcoded to your XAMPP path (e.g. C:/xampp/htdocs/…).
Fix: Update all include/require statements to use relative paths (../config/dbconnection.php) or __DIR__ paths (__DIR__ . ‘/../config/dbconnection.php’). These work correctly on both XAMPP and the live server regardless of where the project is installed.
⚠️ All pages show a blank white screen — no error message
Cause: PHP errors are being suppressed on the live server (production mode hides errors from visitors).
Fix: Temporarily add these two lines at the very top of your index.php or the page showing the blank screen: ini_set('display_errors', 1); error_reporting(E_ALL); — refresh to see the actual error. Once you have fixed the issue, remove these lines — you do not want to show raw PHP errors to visitors.
⚠️ Images and CSS not loading — page looks broken/unstyled
Cause: Your HTML links to assets using absolute paths that worked on XAMPP but break on the live server.
Fix: Check your CSS and image links. Change absolute paths like href="C:/xampp/htdocs/hospital/assets/style.css" to relative paths like href="assets/style.css" or root-relative like href="/assets/style.css". For images in PHP, use: src="/assets/images/logo.png"
⚠️ “Table ‘database_name.tablename’ doesn’t exist” — data operations fail
Cause: Your SQL file was not imported correctly, or it was imported to a different database than the one in dbconnection.php.
Fix: Open phpMyAdmin on the live server, select your database, and verify the tables are there (you should see the same tables that exist on XAMPP). If the tables are missing, import your SQL file again. If tables exist but the database name in dbconnection.php does not match the actual database name (remember InfinityFree prefixes it), update dbconnection.php with the correct full name.

Frequently Asked Questions

Is free hosting reliable enough for a portfolio? Will my site go down?

InfinityFree has reasonable uptime for a free service — typically 99%+ in normal conditions. The main limitation is that if your site gets a sudden spike of traffic (very unlikely for a student portfolio), it may throttle or temporarily suspend your account. For job applications and portfolio purposes, this reliability is entirely sufficient. The bigger risk is that free hosting providers occasionally shut down or change their terms — keep a backup of your files and database locally at all times. If you are actively job hunting and want maximum reliability, a £2/month Hostinger plan eliminates all these concerns.

My university network blocks FTP connections. What do I do?

Use cPanel’s built-in File Manager instead — it works in any browser without needing FTP. Login to your InfinityFree cPanel, click File Manager, navigate to public_html, and use the Upload button to upload your files directly through the browser. For the database, phpMyAdmin also works through the browser with no FTP needed. If your project has many files, zip them first — File Manager lets you upload a single zip and then extract it on the server.

How do I update my live site when I make changes locally?

For individual file changes: open FileZilla, navigate to the changed file on the left (your computer), and drag it to the corresponding location on the right (server) — this overwrites the old version. For database changes: export just the changed table or run the specific ALTER/INSERT query in live phpMyAdmin rather than re-importing the entire database. For large updates, a Git-based workflow (push to GitHub, pull on server) is more professional — but FileZilla works perfectly for student projects.

Should I get a custom domain name for my portfolio?

For maximum portfolio impact, yes. A domain like yourname.dev or yourname.com looks significantly more professional than yourname.infinityfree.net — recruiters notice this. Namecheap offers .com domains for about £8/year and includes free WHOIS privacy. With a paid hosting plan (Hostinger at ~£2/month), you get free domain name included for the first year. This combined investment of under £20/year for a professional portfolio with a custom domain is genuinely worth it when you are actively applying for jobs.


PHP Security Checklist — Fix Before You Deploy →

Secure your project before making it public

The Best VS Code Setup for PHP Developers →

Optimise your development environment first

How to Upload Your PHP Project to GitHub →

Back up your project to GitHub before deploying

Download Free PHP Projects →

Get a project ready to deploy with this guide

Last updated April 2026. InfinityFree hosting details verified April 2026. FileZilla 3.67 used for screenshots. Database migration steps tested on InfinityFree + phpMyAdmin.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top