How to Upload PHP website on cPanel with database

How to Upload PHP website on cPanel with database

In this blog we will learn how to upload php website on cpanel with mysql database, this is an important topic mostly developer develop their website on local server easily but they don’t know how to setup php website with database on live server. Let’s see the following steps:

Step1:  Compress your project in zip format.

Step2: Open your cpanel of web hosting, In cpanel open file manager

DoubleClick on public_html

If you have single website hosting then click on upload button and upload your zip file of project which you have compressed, if you have multiple websites hosting means you have hosted multiple website on single cpanel then you have to upload zip in your domain name directory.

After completion of upload zip file extract it.

Go back to cpanel main screen, create database for website, click on mysql database wizard.

After opening mysql database wizard, screen appear to create database , enter database name whatever you want or you have used on local server, save database name in your notepad file , it will use on connection.php file further.

Create Database user and password.

Check all privileges, click on next step button. You will see the completed task.

Open your connection.php file or file where you have mentioned database detail enter the user name , password, and database name which you have created through mysql database wizard.


$servername = "localhost";
$username = "root";
$password = "";
$db="phpclass4thnew"; // Create connection
$conn = mysqli_connect($servername, $username, $password,$db); // Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
//echo "Connected successfully";