The first thing in hosting a PHP site is
registering a domain name and adopting a web hosting plan of your choice.
Upload your PHP file to the hosting site. You
can upload your site in a variety of ways. However, don't forget that the PHP
file responsible for your homepage must have the name "index.php" and
be located in the "public_html" directory, not in its subdirectories.
Most of the web hosting has an FTP. FTP means
file transfer protocol. To upload your PHP files to the server, you can also
use an FTP client like Filezilla.
You can also upload your files using SSH. SSH
means Secure Socket Shell. However, you must first verify that your web hosting
has this service. With SSH, you can compress a zipped file directly to your own
server. You don’t need to do it manually.
Another widespread way you can upload your files
to your server. That is through your web hosting control panel. Some
hosting providers use cPanel or DirectAdmin or some other control panels. In
this blog, you will get the proper direction for hosting a PHP website to
Cpanel.
Step 1: Sign up on your control panel with the login information
Step 2: Go to your Cpanel file manager option.
Step 3: From the file manager option go to public.html> Click
public.html> here you will find an option named upload> Click the upload
option.
Step 4: After clicking on the upload option you will get a select file
section where you can upload your own PHP file. You must know the file size
before uploading.
Step 5: Now you need to extract the Zip PHP file
You can also edit your PHP file from index.php.
You need to go index.php> click on the right button> there you will find
out the edit option.
After editing, you need to click on save
changes. Then your editing will be saved on the system.
Step6: If your website uses a database, you need to import it along
with your website files:
Final step: Once the website files are uploaded and the database is
created, it’s the final time to check!!
When your domain name points to your web host,
enter the domain name in your browser and see if it points you to your website.
If you follow all the instructions correctly, your website will be displayed
That’s how you can host a PHP website on your
server.