Free tools, Free blogs but Paid services.


How to Create PHP Website (CodeCanyon Scripts)

Create PHP Website

For those of you who purchased a PHP script from Codecanyon and want to install it, or who are PHP developers and want to learn how to create PHP websites online, then you've come to the correct spot.

In this tutorial, I'll go through the following topics:

  • Prerequisites.
  • Purchase a Domain Name.
  • Purchase a VPS Server.
  • Map the IP address of the server to the domain name.
  • For Your Application, Create a MySQL Database.
  • WinSCP is being used to upload a file to the server.
  • PHP Module Installation
  • MySQL Database Administration.
  • Create cronjobs.
  • Requirements for Creating a PHP Website.

Said, what you need is:

  • A VPS Server on which to put your PHP script.
  • To utilize our setup, we'll need a domain name.

1. Purchase a Domain Name for Your PHP Website.

It's as easy as eating a slice of chocolate cake to get a Domain. But, first, you must go to a domain registrar firm such as Bluehost, Hostinger, Hostgator,, Namecheap…. and purchase a domain name; you can even buy one for 1 dollar per year.

I suggest getting a domain name that matches your company's name. You may go on without needing to read this if you have an existing domain, as I believe you have.

2. Purchase a VPS Server.

Now, we're going to get our VPS set up to get our PHP script installed.

What exactly is a VPS Server?

When you wish to create PHP website, script, or web application, we perform what we term “web hosting,” which involves transferring the files and database to a public server so that people can access it online through the internet.

PHP in Web Hosting

Hostings to choose from

The two primary choices for hosting a web application (in our case, PHP scripts) are as follows:

Shared HostingThis refers to publishing your website on hosting providers such as Hostgator, Bluehost, Hostinger, Namecheap,, and others. On the same server as hundreds of other websites.

VPS Hosting (Virtual Private Server)
Your website will be hosted on a dedicated server; you'll have a server all to yourself! It is referred to as a VPS (Virtual Private Server).

Better option?

As much as I'd want to go into the nitty-gritty of it now, we'll save the technical details for later. But in a few words, VPS is always superior since you have your server with complete management and higher performance.

As for shared hosting, if you think it is cheaper, you're mistaken. Contabo VPS services start at only $6.99 per month, the same price as nearly 90% of shared hosting services!

Most likely, its main flaw is that it needs more technical expertise to set up and install, but thanks to this tutorial, you'll see how simple it is!

Which VPS company?

Any company will do, but I'll recommend two companies that provide everything you need at the lowest rates in this article. And I used to manage more than ten servers for my company.

Contabo and Digital Ocean are two of these companies.

But, as I previously said, it is entirely up to you; you may work with whatever business you are most comfortable with. You may also choose Hostinger, which has a highly competitive price when compared to other providers.

Please keep in mind that I will be utilizing Contabo in this lesson.

So, let's examine how we may get a Contabo VPS server.

Purchase a VPS from Contabo.

1. Go to

Navigate to the Contabo VPS Page on your web browser.

Contabo VPS Pricing

To begin, you will see a variety of VPS configurations. You may start with the cheapest option; it will be enough.

In the future, if your company grows, you may upgrade to a more capable VPS with additional resources, or you can just.

2. Configure VPS Options

After that, you'll have to choose a few things.

Select Lamp/Ubuntu 18.04 from the Apps & Panels menu.

Configuring VPS Contabo

Input your domain name if you've been permitted to create a PTR record.

Go through to the payment page and complete your purchase. Other stages, I believe, are straightforward and self-explanatory.

As soon as the Contabo Team has set up the server, they will give you the information through email.

If you choose Digital Ocean

Just go through this Digital Ocean “coupon” & signup.

You'll get $100 to try out everything for free for 60 days.

As soon as you've signed up for a Digital Ocean account, build a Droplet using the

  • Your operating system should be Ubuntu 16/18/20 x64.
  • You may begin with 1 CPU and 1 GB RAM (You can resize later).

Great! You've gotten your server.

3. Connect Domain Name to VPS Server.

Okay, buddy. We now have a domain name and a virtual private server. But they aren't linked!

Using the IP address Contabo Team gave you through email, you may now access your VPS Server. But, of course, we don't want an IP address to visit our WordPress website! So instead, we'd like to make use of our domain name.

So, we'll connect the domain name to our VPS IP and then use both the domain and the IP to access the VPS and the website.

Set up your DNS records as follows:
Enter your Domain Provider's DNS administration zone (in my instance, GoDaddy) and change the primary A record as follows:

GoDaddy DNS Record Connect

Finished? Great! Let's move on.

4. To set up your application, create a MySQL database.

To create PHP website, most PHP scripts and apps will need a MySQL database. So, let's make one.

Use any SSH client, such as putty, to log in to your VPS server. & Let's get started!

Launch Putty, input the server's IP address or name, then press the Open button.

It will prompt you to login; enter “root” as the user, followed by your password, which will be sent to you.

Note: For security concerns, putty will display the password as you enter it, but it's still there; type it!

And now you're in!

What's great is that MySQL is already installed as part of the LAMP Stack; nevertheless, we still need to establish a database and user for our application.

Enter the MySQL root (administrator) account by executing the following command to get started:

mysql -u root -p

You will be asked for the root password; type or paste it and click Enter.

First, build a separate database for your PHP program to utilize. You may name it anything you like, but for the sake of simplicity, we'll call it PhpDb in this tutorial. Then, run the following command to create the database:


Note: MySQL statements must finish with a semicolon (;)

Following that, we will establish a second MySQL user account that we will use solely for database operations. Management and security are excellent reasons to create databases and accounts with a single purpose. In this tutorial, we'll refer to you as phpUser. You are allowed to modify this if you so want.

We will create this account, establish a password, and assign database access privileges to the database we just made. We may do this by using the following command. For your database user, select a strong password:

CREATE USER 'phpUser'@'localhost' IDENTIFIED BY 'enter_a_custom_password_here';
GRANT ALL ON TestDb.* TO 'phpUser'@'localhost';

A user account and database have been created for your PHP program, each with an associated password. For MySQL to be aware of recent modifications, we must flush the privileges:


Quit MySQL by typing:



5. Upload Scripts to Server

You'll need a program named WinSCP to upload the files.

It's a free tool that you may get by clicking here.

Enter the location “/var/www/html” into WinSCP and then update your PHP files on your VPS server.

Unfortunately, most files are zipped; therefore, we must extract them.

Return to Putty SSH Client, and now use the following command to install the unzip utility:

sudo apt-get install unzip

First, to clear up the putty screen, use the following command:


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

cd /var/www/html

After that, use the following command to unzip the “.zip” file:


*Please keep in mind that your file name may vary; therefore, change YOURFILENAME to your file name.

Now, copy the contents of the most recent folder to the higher directory so that you can access it directly -> use WinSCP
Copy all of the files from the “YOURFILENAME” folder and put them straight into the Html folder.

Now, the files have been uploaded. Step Completed!

6. Installing PHP Modules in Order to Create PHP Website (optional)

Some PHP applications will need the installation of extra PHP modules on your server ( mentioned in the application documentation)

To install more PHP modules, follow these steps:

To install PHP Modules, use Putty and enter the following commands:

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

*Use the following command to restart the Apache service:

sudo service apache2 restart


7. Set up Apache to Create PHP Website.

Congratulations, To create PHP Website, we must set up Apache to access our script by typing the domain name into the browser's address bar. To do so, restart WinSCP and browse to the following directory: /etc/apache2/sites-available/.

Now, create a new, empty file and call it “yourdomain.conf”. You may replace any name for “Scriptname” (for example, naming it to solicit.conf).

Navigate to yourdomain.conf. Then paste the text below into your document, and save it.

     ServerAdmin admin@YOUDOMAINNAME
     DocumentRoot /var/www/html
     ServerAlias YOUDOMAINNAME
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

Replace “YOURDOMAINNAME” with your domain.

Restart the service after enabling your script settings in Apache.

To complete the configuration, just execute the following commands:

sudo a2ensite yourdomain.conf
sudo a2enmod rewrite
sudo systemctl restart apache2.service 

We are almost done 🙂

8. Connect MySQL Database.

Type your server name into your web browser and go there immediately.

It would help if you viewed the setup completion wizard, which is shown below:

As you go with the setup, you'll need to input the database information Database name is PhpDb, the user name is phpUser, and the password is specified in our example.

That easy!

Php Database Login

Make a connection to the database. Completed!

9. Cronjobs setup

What exactly are cronjobs?

It is a Linux utility that sets a task or script to execute automatically on your server at a given time and date. A cron job is a scheduled task in and of itself. Cron jobs are beneficial for automating repetitive activities.

To save disk space, you may, for example, create a cron task to remove temporary files every week. In addition, some PHP web applications may need the creation of a cron job to execute specific tasks.

Setting up cronjobs

You must add all necessary tasks to the server before you can set up cronjobs. For example, code canyon should offer you cronjobs when you purchase a script.

To do this, use WinSCP and go to /etc.
If you are using an editor, open the crontab file, and paste all of your script's (The program documentation includes a list of cronjobs)

Check that each task is on a separate line and an empty line at the end.

Cronjobs. Completed!

10. Free SSL

SSL certificates are being used inside servers to encrypt communication between the server and the client, giving additional protection to people who use your service. Let's Encrypt offers a free and straightforward method to acquire and install trustworthy certificates.

Putty SSH client is used to connect to your server. & Let's Get Started!

Step 1: Download and install the Let's Encrypt client.

Let's Encrypt certificates are obtained via client software installed on your server. Certbot is the official client.

First, add the following repository to your system to install Certbot:

 sudo add-apt-repository ppa:certbot/certbot 

To accept, you must hit ENTER.

Then, to include the new repository's package information, update the package list:

 sudo apt-get update 

Install the Apache package from Certbot:

 sudo apt install python-certbot-apache 

Certbot is now operational.

Step 2: Configure SSL Certificate.

Certbot makes it simple to generate an SSL certificate for Apache. The client will acquire and install a new SSL certificate valid for the domains specified as arguments.

Type the following command into your terminal: (change the domain)

 sudo certbot --apache -d YOUR_DOMAIN_NAME

You will be prompted to enter an email address for lost key restoration and notifications. You will be given the option of allowing either HTTP and HTTPS access or requiring all queries to divert to HTTPS. Unless you have a particular requirement for unencrypted HTTP traffic, it is generally safer to enforce HTTPS.

That's all!

Now that you've tested your website, it will be SSL secured.

Task Completed!

Congratulations, now you have a functional PHP website up and running. If you have any questions, feel free to ask them down below in the comment sections!

Share on facebook
Share on twitter
Share on linkedin

Related Articles


DesignCap Review

Pros Provides low-cost plans There is a free version of DesignCap available. Thousands of templates are available. Implements flexible upgrade and refund policies Cons There

Read More
Brand It marketing

Brand IT Agency


Welcome to our website! If you’re interested in making money online or want to know how to start your online business or want to learn about digital marketing? Don’t forget to subscribe. Thank you.

Mirza Rihad Ali Sunny

Beginners Guide
Deal of the week
Loading Preview...
Powered by Creative Market

Leave a Reply

Your email address will not be published.