Host A PHP Script Online: Step-by-Step Guide for Success 2023


featured-image

Host A PHP Script Online

If you are working as a developer and desire to host a PHP script 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 Files 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. 

Host A PHP Script Online

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

Getting Started

When getting started, a Public VPS Server is the first thing you need to host your PHP web application. So, in this scenario, I will use Digital Ocean for the VPS Server for 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 create 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 is not locally 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 it, please subscribe to our newsletter and follow us on FacebookYouTube, and Twitter.

author

Posts that we highly recommend you to read

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.

    Reply

Leave a Comment

Join our community and discover the secrets of online income