How to upload website files to a Cpanel account
How to upload website files to a Cpanel account
Having completed creating your website locally arises then need to host the website.
After purchase of domain name and hosting account, this tutorial becomes crucial
There are possibly two situations
- A website with no database
- A database driven Website
Hosting a no database website
This could be a purely HTML site or even php.
It is the simplest website to host.
There are two ways of uploading the website files to a hosting account
i.Mass Upload using File Manager
ii.FTP upload using FTP Client
i. Mass Upload Using File Manager.
Zip your website files – make sure you use .zip extension i.e mywebsitefiles.zip
From your browser access the hosting account that you already purchased.
i.e after your domain url put /cpanel and load it.
Login with username and password provide from TrueHost
A successful login takes to the Cpanel (control panel) area.
Click on the ‘File Manager’ icon
Make sure it leads you to the public_html or www directory
If it leads you to another directory like home, click on public_html or www links to go the public_html or www directory.
Click on ‘Upload’ link
Browse the location of mywebsitefiles.zip
Select mywebsitefiles.zip to start upload.
When upload is complete, click on go back to /home/username/public_html (username is your Cpanel username) link to go back to public_html or www directory
Among other folder or files in the directory there is mywebsitefiles.zip
Right click on it and select’ Extract’ option
Content of files are extracted to a mywebsitefiles folder
Double click on the mywebsitefiles folder to open it
Select all the files
Click on the button / menu link ‘Move’
Choose the correct directory to move your files to i.e /home/username/public_html
(by just removing the /mywebsitefiles from the already provided path )
Click ‘ok’/ ‘move’ to move them
Click ‘up one level’ to go to the public_html or www directory
You may delete the empty folder mywebsitefiles and mywebsitefiles.zip
You are now up and live. –congratulation
ii. FTP upload using FTP Client
Open a FTP client software like FileZilla (if already installed, download for free and install if not) from your computing device
Login with credentials provided
Username: your Cpanel username
Password: your Cpanel username
The click Quickconnect button
It will open your hosting account on the ‘Remote Site’ panel – on the right side
Click on public_html or www folder to go to the public_html directory
On the left panel is the location of website on your computer yourwebsitefiles
Make sure on the left panel you can see your website files and folders
Use Ctrl+A or otherwise to select all your website files,
Right click on them and choose the option ‘upload’
Upload of files start, if it times out choose an option Resume to upload files in the queue incrementally
When you see directory listing successful – disconnected from the server.
Bingo! You are up and live – congratulation
Hosting a database Driven Website
Hosting a data base driven website on a Cpanel hosting as offered by Truehost is simple.
They only difference between hosting a non-database driven website and website driven website is that a database driven website require database set up and upload.
Setting up database for a website, during web hosting
Login to your Cpanel using credentials provided by Truehost Kenya.
Basically mean clicking on the Cpanel url http://www.yourdomain.com/cpanel or http://www.serveripaddress/~yourusername/cpanel
Input your username
Input your password
On successful login, proceed to click mysql databases icon in the Cpanel
Creating a database
Under create database
Give your database a name
Click create database
Database name will therefore be your username_newnameyouhavegiven
Adding User to a new database
Online databases do not use the root user as default on localhost (local development phpmyadmin)
Under add new user
Username should have fewer than 7 characters
Input a desired database password
I recommend to use password creator to have a strong password.
At this point make sure you have saved your database name, your database username and your database password in a text file for use in your website.
Adding user to your database
Under Add a User to a Database
Selected the user you have created
Select your database
Click Add to add
It prompts you for roles to issue you database user
You may select all
Then presses add to finalize.
Make sure you have exported your database from your localhost (local development environment) to a .sql file or .zip file if you are dealing with large database.
From your Cpanel Home
Click on phpmyAdmin icon
It will open in a new tab
Choose the database created earlier from the left side panel
Click on the database
Click on import option
Browse the location of your exported database
Select database file to import
On Successful import – you will have uploaded your database
Upload the files in the normal way as illustrated in the upload of non-database driven website tutorial
Ensure database connection or config files of your website reflect the new database name, new database user, new database password
Server should remain localhost unless advised otherwise by Truehost team.
Bingo – u r live now.