How to host A PHP Script online | Step By Step

Pinterest LinkedIn Tumblr
7.3k
views

Host A PHP Script Online

If you are working as a developer and desired to host and install the web application i.e., host a PHP script online, then follow the above guidelines to complete the installation process successfully. 

In this article, I will walk you through a brief guideline on how to host a PHP Script online in a couple of minutes. So first, go through the main concept:

  • Creating a VPS Server
  • Configuring the Server Using Putty SSH Client
  • Uploading File to the Server using WinSCP
  • Installing PHP Modules
  • Managing MySQL Databases
  • Setup cronjobs
  • Mapping our Domain Name

Let’s start the process, here I’ll take the “XEROCHAT FACEBOOK MARKETING APPLICATION” as an example script. This script requires some PHP modules, a Database, and some cronjobs.   

You can better understand the concept through this example. So, the hosting and installing process will be easy for you to understand.

Getting Started

Getting started, Public VPS Server is the first thing you need to host your PHP web application on. So, in this scenario I will use Digital Ocean for VPS Server because of the following two reasons:

  • The first reason is already configured servers (LAMP) that make it a lot easier to host a PHP script. There is no need to install Apache, MYSQL, PHP, or anything else.
  • The other one is a free coupon, where you can test everything for free and just go, click and sign up to get the coupon.

What will you need

If you want to install WordPress on DigitalOcean then you need this article to follow

Install wordpress on DigitalOcean

Reset Droplet Password

You will get the email containing the root default password when you created the Droplet. So, use the Putty SSH Client to connect to your Droplet and reset the password.

Upload PHP Files to Your Server

Then, use the WinSCP to connect to your VPS server and update the PHP files to the server through the given path:

Getting Started

In this scenario, I have zipped files that need to be extracted. So, again to Putty SSH Client and install the unzip utility by running the following command:

sudo apt-get install unzip

Run the following command to clear the putty screen to make in clean:

clear

Then, change the directory to /var/www/html by running the following command:

cd /var/www/html

Unzip the files by running the following command:

unzip xerochat.zip

*Note:

In your case, the file name can be different so, rename the files with your file name.

Now move the content folder to the upper directory to be accessed directly -> use WinSCP.

Then drag and drop by using WinSCP

Delete the html folder and replace the “xerochat” with html.

Now your PHP files are in the html folder, so you can use your domain name to access the script directly.

Start Installation

Now you can open the application startup page by entering the Droplet IP into the browser.

Install PHP modules

Open putty, and install the PHP modules by running the following command:

sudo apt install php-curl
sudo apt install php-mbstring

Now, run the following command to restart the Apache service:

sudo service apache2 restart

Create the Database

1- Open Putty SSH Client and run the following command:

 mysql -u root -p 

Login to MySQL with your root password

2- Create the database using the following command:

CREATE DATABASE xero;

3- If the root has not local accessible, then create a new user:

CREATE USER ‘xero’@’localhost’ IDENTIFIED BY ‘Xero_db_pass123’;
GRANT ALL PRIVILEGES ON * . * TO ‘xero’@’localhost’;
FLUSH PRIVILEGES;

Setup cronjobs

Now, setup the cronjobs by following the above steps:

  • Open the WinSCP and go to /etc
  • Use the editor to open crontab and paste all the jobs from Xerochat

Now, point your domain name to your IP address in the DNS management zone. That’s it.

GoodLuck!

Thanks for Reading.

If you liked this article and want to read more of these, please subscribe to our newsletter and follow us on FacebookYouTube, and Twitter.

Got a question? Comment here or open a thread. We will help!

Subscribe to SG-Educate

Subscribe to our daily newsletter to get the latest industry news.

newsletter
author-image

John is a senior web developer and instructor for SG-educate. He also writes and edits a variety of web-related articles. He has unique specialities in Search Engine Optimization (SEO), Off-Page SEO, Keyword Research, HTML, CSS, JavaScript, Php, Digital Marketing, and Search Engine Marketing (SEM).

2 Comments

  1. Important Factors Any time Playing Slot Joker123 Games
    In typically the business world, what do you have in order to do to become successful? Obviously beginning from the correct place such as choosing the proper job or a new bona fide office. Likewise in online slot games. You have to start from the right place to become on the trail in order to success.

Write A Comment

Logo-ebooks

An Essential Guide for
Higher Ranking.

seo-book
logo-ebooks

FREE AMAZON MILLIONAIRE GUIDE.

amazon-book
popup-image

Subscribe To SG-Educate

Subscribe to our daily newsletter to get the latest industry news.