How To Host a PHP Website For Free
Hey, there my name is Kushagra Jaiswal today I'm going to tell you how to host your PHP MySQL website for free so here are some steps you should need to follow to host your website:-
1. Create an account on Infinity free:
so first of all you need to create an account on Infinity Free if you don't have an account.
Infinity Free is a web hosting platform that provides you to host your PHP MySQL website you can host a minimum of 3 websites for free on this platform.
sign up if you do not have an account, for signing up you have to provide your email address and a link will be sent to your email for verification and your account will be created on this platform.
After verifying your email address you will be thrown to a dashboard page of the Infinity free website which will look like this:
2. Creating Hosting Account And Sub Domain:
Now you have to click on the Create account button which is in the above image which is on your dashboard.
Now you have to click on the subdomain and write the name of your website in my case I am writing "docapp" and select the domain extension as "infinityfreeapp com".
Now click on the check availability button if the domain name is available it will be allotted to you.
After checking the availability for the domain name as you can see there is an account username that is disabled so it is generated automatically there is also an account password section where you can write your password but if you don't write any password it will generate your password randomly so I am generating my password randomly in my case.
After entering your password click on create account button to create your account for the website which you are hosting.
After clicking on Create an account it will show you that your account has been created.
Now you have to open the control panel by clicking this button.
3. Setting Up The Control Panel:
After clicking on the "open control panel" button it will take to you a new tab where you will see an important notice so you have to click on I approve button to move further.
After clicking on the I approve button it will take you to the dashboard page where you have to deploy your project.
So as you can see in the above image on your panel you have phpMyAdmin MySQL and everything which is required to host your website and to run your website web application online so now you have to set up all these things.
4. Important Steps For Deployment :
Now you have to click on Open File Manager under the file section as shown in the image.
The interface for File Manager will look like this in the above image.
Now you have to go inside the htdocs folder and you have to delete whatever is inside that folder.
After deleting everything from htdocs folder you have to drag and drop all your applications files into that folder as shown in the below images.
As you can see my application folder name is the appointment app where I have made a doctor appointment project I want to host that project so I have to drag and drop all the files which are inside the appointment of the folder into the htdocs folder on my web browser.
These are the files that I have to drag and drop on the website.
The file is copied on the website as you can see in the below image.
Now we have to go to the MYSQL database page so for going to that page you have to go to the dashboard page where you will get an option under the databases section.
After clicking on my sequel database interface will open like this in the below image.
Now you have to create a new database as you have created in xampp localhost.
In my case, I am writing "appointment_app" as my database name.
Now click on the Create Database button to create your database.
After creating the database your panel will look like this in the current database section you will have one database which you have created.
Copy the information of current databases in your notepad or somewhere else and now click on the admin button.
Your admin panel will look like your local host as given below in the image.
So for running the website, you have to create all the tables which are present in your localhost for running your web application.
In the below image, I have provided my local database table which is on my localhost.
In my case, I have to create an admin, appointment, doctor schedule, and users table.
As you can see on the left side there is PHP my admin local host where I have created my application and it is working on my local host there is my appointment apps database where all the tables are present and on the right side I am creating new tables for my same web application which I want to post so I am creating the table as it is which I have created in my local trust you guys also have to create your SQL table as you have created in your local host for the web application you are hosting.
After creating all the tables you have to go to the File Manager on the browser given below.
Now you have to click on the online File Manager then an interface of File Manager will open which would look like this:
You have to go inside the St docs folder where you have dragged all your application files.
After going inside the St docs folder you have created a partial folder in your web application in my case I have a partial folder so we have to go inside that folder.
Inside the partial folder, you may have "connect.php" file I have created in my application "_dbConnect.php" the file have to replace the old localhost database with a new database name which we have created in the Infinity free website so you can get your new database name on the create database section which I have shown you before steps where I have shown you how to create a database in that image in the current database section you will get all the details of your database.
When you click on the "connect.php" file you will get an option to edit your file you have to edit the database name inside that file as I have edited in the below image.
You also have to change the username and the password in the online connect.php
show for getting your password which is randomly generated you have to go to the panel which comes up when you log in to the Infinity free website.
In your accounts section click on the first one dear you will get your password.
As you can see in the above image I have got my randomly generated password it is hidden so I can click on the show button and I can copy the password and for this password, we have to paste it into that "connect.php" file.
You also have to replace the local host from the hostname provided by the Infinity free websites so for getting the MYSQL hostname you have to go to the Infinity free dashboard there on the right side you will find the MySQL hostname so copy that and paste it into "connect.php" file.
After replacing all the things from "connect.php" it should look like this:
Now save this connect dot PHP file and you can open the URL which is provided by the website for your web application it should be working.
As you can see in the URL my website is successfully hosted on the platform Infinity free and its working for free.