Publish dynamic website using infinityfree for free

Most of my Web Devs friends were asking me "How can I publish my dynamic website where backend is involved?" "Is there any website which offers free hosting facility?" "Where to purchase cheap domains for showcasing my websites?". If you too have these questions, my friend, you're in correct place. I've tried to explain this in most simpler way possible along with some notes at the end.

Here, I'm going to discuss how to publish a dynamic website using InfinityFree. Why only InfinityFree? 'coz I was using it since 2019 & I just need to visit that site once a week to not get my site into inactive status due to obvious reasons. They've free hosting and domain facility. We just need to search for our subdomain, whether it's available or not. Let's get started.

Steps to consider in general

  1. Login to InfinityFree
  2. Upload the contents inside ./htdocs directory
  3. Create DB
  4. Connect FrontEnd & BackEnd

Pre-Requisites

  1. An InfinityFree account
  2. Project in normal HTML, CSS, JS, SCSS etc & MySQL

Steps in details

  1. Login to InfinityFree portal

Login to Infinity Free

  1. Click on "Create Account" button to create new website. Put subdomain name >> Put password >> Confirm you're human (Ewww..) >> Click on "Create Account" button

Create Account

  1. Account created. So, wait for 30s for CPanel to be fully ready to be used.

CPanel

  1. Open File Manager >> navigate to htdocs directory

Open File Manager

  1. Upload your project files here only (as written in the file too here). You can use Drag-and-Drop method to upload OR You can use uploading zipped file of whole folder & then extracting it OR You can upload all files(not folders) using "Upload(bottom left corner) button". I'm going to chose 1st method.

Upload project

  1. Now, open CPanel(click Control Panel from Home)

Open CPanel

  1. Open "MySQL Databases" from Databases tab

Open MySQL

  1. Put database name as it is here & click on "Create Database". You'll be able to see it under Current Databases.

Put DBname

  1. Click on "Admin" button now.

Click on Admin

  1. Click on import TAB >> Chose the .sql file >> Click on "Go button" in the bottom >> Database will be imported.

import sql

  1. Now time for last part - Connecting FrontEnd and BackEnd. Go to the connection file, maybe conn.php. In my project, it's dbConnection.php. Open the file using Edit option in new tab.

connection

  1. Now, to check the username, head over to Control Panel & on the right-hand side, search for "MySQL Username" and "MySQL hostname" under "ACCOUNT DETAILS" menu. Put them in the file

check username

  1. You also need password & DBname for connection. For password, head over to the home & click on Show/Hide button to reveal the password. BTW, you chose any one of them to reveal the password.

check password

  1. For database name, there's a simple trick. Just add your username & underscore before your actual database name. For eg: username is 'epiz_32524006' & dbname is 'nitscv', then database name is going to be 'epiz_32524006_nitscv'. You can also get your database name from Step 8 above or navigating to "Current Databases".

check dbname

  1. Put these 4 variables in the file dbConnection.php (You may have a different name for connection file) & Save it by clicking on "Save" button.

<?php $con= new mysqli('sql113.epizy.com','epiz_32524006','uk94JI6uj7nKn','epiz_32524006_nitscv')or die("Could not connect to mysql".mysqli_error($con)); ?>

put details

  1. Now, just wait for the magic to happen & check whether the subdomain is up & running or not. But wait, what is subdomain here? You've tried to check for a subdomain in 2nd Step right? This is the portal name you want to create. You can get it in homepage.

subdomain is up

You can also check it by going more down in same page.

subdomain name

  1. Your website is live now. It's published. Let's see mine one.

website live

Facing some issues? You can always head over to the Community Forum of InfinityFree or in their forum docs.

I'm an old customer of InfinityFree, so you can also ask me after checking above resources provided.

Comments

Popular posts from this blog

Publish your static website for free