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
- Login to InfinityFree
- Upload the contents inside ./htdocs directory
- Create DB
- Connect FrontEnd & BackEnd
- An InfinityFree account
- Project in normal HTML, CSS, JS, SCSS etc & MySQL
Steps in details
- Login to InfinityFree portal
- Click on "Create Account" button to create new website. Put subdomain name >> Put password >> Confirm you're human (Ewww..) >> Click on "Create Account" button
- Account created. So, wait for 30s for CPanel to be fully ready to be used.
- Open File Manager >> navigate to htdocs directory
- 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.
- Now, open CPanel(click Control Panel from Home)
- Open "MySQL Databases" from Databases tab
- Put database name as it is here & click on "Create Database". You'll be able to see it under Current Databases.
- Click on "Admin" button now.
- Click on import TAB >> Chose the .sql file >> Click on "Go button" in the bottom >> Database will be imported.
- 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.
- 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
- 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.
- 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".
- 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.
$con= new mysqli('sql113.epizy.com','epiz_32524006','uk94JI6uj7nKn','epiz_32524006_nitscv')or die("Could not connect to mysql".mysqli_error($con));
- 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.
You can also check it by going more down in same page.
- Your website is live now. It's published. Let's see mine one.
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.
Top comments (0)