How to Host a PHP Website (Step By Step)

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.


  • That’s how you can upload your PHP file to the server. 

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:

  • Create a new MySQL database and user.


  • Access your newly created database with PHPMYadmin.


  • Use the Import section to upload backup files to your database.


  • Update MySQL database connection details (hostname, database name, username, password) in its configuration 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. 


Need Help With A Project?

Let's Talk !

Get support on a large platform, flesh out your first MVP, go from concept to investment, or take your startup to the next level. Our process wraps around your unique business needs.