How to Publish PHP Website (Install CodeCanyon Scripts)

host php application

In case you bought a PHP script from Codecanyon and you want to install it, or maybe you are a PHP developer, and you want to learn how to publish PHP website online, Then You are in the right place.✔️

In this guide, I will cover the following:

  • Requirements .
  • Get a Domain Name.
  • Get a VPS Server.
  • Map Server IP to Domain.
  • Create a MySQL Database For Your Application.
  • Uploading File to the Server using WinSCP.
  • Installing PHP Modules.
  • Managing MySQL Databases.
  • Setup cronjobs.

Requirements to Publish PHP Website.

What you need is simply is:

  • A VPS Server to install your PHP Script on.
  • Domain Name to use with our setup.

1. Get a Domain Name To Publish PHP Website.

Getting a Domain is as simple as eating a piece of chocolate cake. you need to go to any Domain registrar company like Godaddy, Hostinger, Enom, Freenom, Namecheap…. and Buy a Domain Name, you can even get one for 1$ per year.

I do recommend to get domain name that reflects your business. and if you already have one, as I think so, you can just skip this, and continue to get a VPS Server.

Watch this 3 Minutes Video and see how to get and buy a domain name from Godaddy:

2. Get a VPS Server.

Now, Let’s get our VPS server to set up our PHP Script on.

What is a VPS Server?

When you want to publish PHP website or script or any web application, we do what we call “web hosting” which simply means uploading the files and database into a public server so it can be accessibly Online over the internet.

How To Publish PHP Websites

Hosting Options.

Now when you want to host a web application (WordPress in our scenario), you have mainly 2 options:

Shared Hosting:

Which means publishing your website on hosting services like Godaddy, Bluehost, Hostinger… where your website will be hosted with hundreds of other websites on the same server.

VPS Hosting

In this setup, you will host your website on your own server, so you will have a server only for you! which is called a VPS or a Virtual Private Server.

Which one is better?

I don’t want to go in depth now and explain technical stuff, but in few works, VPS is Definitely better where you will have your own server with full manageability and better performance.

And if you think that shred hosting is a lot cheaper, then you are wrong, as with Contabo VPS services you can start with a 3.99 € per month Only which is the same pricing for almost 90% of shared hosting services.

Maybe the only drawback here, is that it requires some more technical skills to set up and configure, but fortunately, you are here in the step-by-step guide, where you will see how things will go really easy!

What company should I use?

You can use whatever company you want to buy a VPS Server, in this guide I will share with you two companies that I think has everything you need, and with the cheapest prices. and I use to run more than 10 Servers for my business.

These companies are: Contabo & Digital Ocean.

But as I told you, it's up to you, you can use whatever company you feel comfortable with. you can also go with Hostinger, which also provides a very good pricing compares with other companies.

Note: In this tutorial: I will be using Contabo

So Let's see how we can get a VPS server from Contabo.

Get a VPS Server From Contabo.

1: Open Contabo Website.

Open your web browser and navigate to Contabo VPS Page.

Contabo VPS

You will see multiple VPS configuration to start with. You can simply start with the cheapest option to Install WordPress, it will be more than enough.

Later on, when you grow your business, you can scale up and get a more powerful VPS with Higher resources.

2: Set VPS Options

On the Next Page, you will need to select some options

In the Operating System Option, Select Ubuntu 18.04

Install WordPress on Contabo VPS Ubuntu
Select Ubuntu 18.04

Then in the Administration Panel, Select LAMP

Install WordPress on Contabo VPS LAMP
SELECT LAMP

And last option, In the Addons, check “Individual reverse DNS”

Install WordPress on Contabo VPS
Add PTR

If you were promoted to enter the PTR record, enter your domain name, and That’s it.

Now, Just Continue to the billing page, and confirm your order. I think other steps are simple and self explanatory.

In like 24 hours, Contabo Team will setup the Server and send the details to your email like this:

Install WordPress on Contabo VPS
Login Info

For Digital Ocean.

If you want to go with Digital Ocean, simply Sign up through the coupon link below to get free 100$ to test everything free.

And after you signup on Digital Ocean, just create a Droplet with the following specifications:

  • Ubuntu 16/18/20 x64 as your operating system.
  • You can start with 1 CPU/ 1 GB RAM (You can resize later).

Great! You Got Your Server. ✔️

Check Also:

How To Install WordPress on Contabo VPS (WITHOUT cPanel)

3. Map Domain Name to your VPS Server.

Ok Friend, Now we have a Domain and a VPS Server. But they are not connected!

Your VPS Server can be accessed now through the IP address that Contabo Team sent you by email. but of course, we don’t want to access our WordPress website though an IP! we want to use our domain name.

So simply, we are going to map the domain name to our VPS IP, so then we access the VPS and the WordPress website through both the domain and the IP.

Configure your DNS Records:

Simply open DNS management zone in your Domain Provider (Godaddy in my case) and edit the main  A record like this:

host: @ points: YOUR SERVER IP.

map domain to vps

Done? Great! ✔️

4. Create a MySQL Database For Your Application.

To Publish PHP Website, the Majority of PHP scripts and applications, will require a MySQL Database. So Let's Create one.

Connect to your VPS server using any SSH client like putty. and Let’s start!

putty

Just open Putty and enter the Server IP or Name, and Press Open.

It will ask you to login, just enter “root” as the user, then enter your password which is sent to you by email.

Note: while typing the password, putty will now show it for security reasons, but It’s there, just type it!

install wordpress on contabo
Login with putty

And you are In! 

What's nice, is that we have MySQL installed already as part of the LAMP Stack, but we need to create a database and a user for out application.

To get started, log into the MySQL root (administrative) account by issuing this command:

mysql -u root -p

You will be prompted for the root password, just write or paste it and press Enter.

First, create a separate database that your PHP application will use. You can call this whatever you want, but we will be using TestDb in this guide to keep it simple. Create the database by running this command:

CREATE DATABASE TestDb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Note: Every MySQL statement must end in a semi-colon (;)

Next, we are going to create a separate MySQL user account that we will use exclusively to operate on our new database. Creating one-function databases and accounts is a good idea from a management and security standpoint. We will use the name DbUser in this guide. Feel free to change this if you’d like.

We are going to create this account, set a password, and grant access to the database we created. We can do this by typing the following command. Remember to choose a strong password here for your database user:

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

You now have a database and user account, each made specifically for Your PHP application. We need to flush the privileges so that the current instance of MySQL knows about the recent changes we’ve made:

FLUSH PRIVILEGES;

Exit out of MySQL by typing:

EXIT;

Done! ✔️

5. Upload The Script Files To The Server.

To upload the files, you need an application called WinSCP.

It is a free tool and you can download it from here.

Connect to Your VPS Server using WinSCP, and Update the PHP Files to the server to this path: “/var/www/html”

In most cases, the files would be zipped, so we need to extract them.

Again to Putty SSH CLient and Let’s install the unzip utility using the following command:

sudo apt-get install unzip

Clear putty screen to make in clean using the following command:

clear

Change directory to /var/www/html using the following command:

cd /var/www/html

Unzip the “.zip” file using the following command:

unzip YOURFILENAME*.zip

*Note: the file name may be different in your case, so replace YOURFILENAME with your file name.

Now, Move the latest folder content to the upper directory so it can be accessed directly -> use WinSCP
Just copy all the files inside “YOURFILENAME” folder and paste them directly in html folder.

Files Uploaded. Done! ✔️

6. Installing PHP Modules To Publish PHP Website (optional)

Some PHP applicaiton will require some additional PHP modules on your server( this is will be mentioned in the app documentation)

To Install additional PHP modules:

Open Putty, and run the following commands to install PHP Modules:

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

*Restart apache service using the following command:

sudo service apache2 restart

Done! ✔️

7. Configure Apache to Publish PHP Website

Well Done, Now your files are uploaded and placed in the html folder, we just need to configure apache so we can our Publish PHP Website and access our script using our domain name. To do so, open WinSCP again and navigate to this directory: /etc/apache2/sites-available/

Now, create a new empty file and name it “yourdomain.conf” . You can replace “Scriptname” with any name you want (Below is an example naming it mautic.conf).

SCRIPT Conf
Create Conf

Open yourdomain.conf Then copy and paste the content below into the file and save.

<VirtualHost *:80>
     ServerAdmin admin@YOUDOMAINNAME
     DocumentRoot /var/www/html
     ServerName YOUDOMAINNAME
     ServerAlias YOUDOMAINNAME

     <Directory /var/www/html/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Replace with your own domain, in my case its “YOURDOMAINNAME”

Enable your script configuration in apache and restart the service.

Now simply, run the following commands to finish the setup:

sudo a2ensite yourdomain.conf

sudo a2enmod rewrite

sudo systemctl restart apache2.service 

GREAT! You are almost done

8. Connect to MySQL Database.

Open your web browser now and navigate to your server name.

You must see the setup completion wizard below:

Continue the setup by entering the database info and your admin login information. In our example, the database name is TestDb and the user is DBUser with the password set.

That simple! Check below example from a similar script.

Connect to database. Done! ✔️

9. Setup cronjobs.

What are cronjobs?

cron is a Linux utility which schedules a command or script on your server to run automatically at a specified time and date. A cron job is the scheduled task itself. Cron jobs can be very useful to automate repetitive tasks.

For example, you can set a cron job to delete temporary files every week to conserve your disk space. Some PHP web applicaitons, may require you to set up a cron job to perform certain functions.

Setup cronjobs.

To setup cronjobs, you need to add all required jobs to the server. This depends on your script, so if you bought a script from code canyon, the script owner should provide the cronjobs.

To do this, open WinSCP and got to /etc
Open crontab file using the editor
And paste all the jobs from your script to this folder. (cronjobs are listed in the app documentation)

Make sure each job is on a line and an empty line in the end.

Cronjobs. Done! ✔️

10. Secure with a Free SSL.

SSL certificates are used within web servers to encrypt the traffic between the server and client, providing extra security for users accessing your application. Let’s Encrypt provides an easy way to obtain and install trusted certificates for free.

Connect to your Server using Putty SSH client. and Let’s Start!

Step 1 — Install the Let’s Encrypt Client

Let’s Encrypt certificates are fetched via client software running on your server. The official client is called Certbot.

First, add the repository to install Certbot:

 sudo add-apt-repository ppa:certbot/certbot 

You’ll need to press ENTER to accept.

Then, Update the package list to pick up the new repository’s package information:

 sudo apt-get update 

Install Certbot’s Apache package:

 sudo apt install python-certbot-apache 

Certbot is now ready to be used.

Step 2 — Set Up the SSL Certificate

Generating the SSL certificate for Apache using Certbot is quite straightforward. The client will automatically obtain and install a new SSL certificate that is valid for the domains provided as parameters.

Simply run the following command: (change the domain)

 sudo certbot --apache -d YOUR_DOMAIN_NAME

You will be asked to provide an email address for lost key recovery and notices, and you will be able to choose between enabling both http and https access or forcing all requests to redirect to https. It is usually safest to require https, unless you have a specific need for unencrypted http traffic.

That’s it! 

Test your website now and it should be SSL encrypted.

Done! ✔️

Related Articles

Responses

Your email address will not be published. Required fields are marked *

      1. Urgent: This is the error i am getting when i try to set up the Premium URL Shortener script on my VPS server. The error is “SQLSTATE[HY000] [1044] Access denied for user ‘dbuser’@’localhost’ to database ‘urlDB'”

          1. i am facing a big problem while running my php script which i bought from code canyon i am following the video tutorial of hasan from his youtube channel i please request you to please get my problem solve first i am getting the 404 error and now the admin dashboard is also not working and saying page can;t load can anybody knows how to reset all the things and start uploading from start please guide me

          2. Reinstall the OS on your VPS and start fresh. Please post issues similar to this on our forums for better help.

  1. HI Hasan,
    Everything you tell in the video but Did not tell whether to take web hosting or not.
    and can I make the same SEO tool web site like you?

    1. What do you mean webhosting friend? We mentioned that you need a VPS server. For more questions please head to h-educate.com/forums to help you better.

  2. HI Hasan,
    Everything you tell in the video but Did not tell whether to take web hosting or not.
    and can I make the same SEO tool web site like you?

  3. Dear Hassan,

    First of all, let me appreciate your kind efforts and the humanism you are imparting on the internet. Well done! You are really a great person!

    My name is Kashif Soomro, and I watch your videos on YouTube and try to follow your guidelines.

    After watching your videos, I installed the A to Z Tools PHP script on my website.

    But the issue is that features of the application are not working despite successful installation.

    Bro can kindly guide me on how to resolve this issue. I would be really grateful.

    Looking forward to your early response.

    Thank you and kindest regards,

      1. please check the spelling of the file if a word is capital then write it in capital while using unzip command

  4. Step #7
    * If you create own yourdomain.conf file, then you have to assign new file and remove old one:
    sudo a2ensite your_domain.conf
    sudo a2dissite 000-default.conf

    * Test if all synatx is good:
    sudo apache2ctl configtest

    * You should see something like:
    Output
    Syntax OK

    * Now it is time to restart:
    sudo systemctl restart apache2

  5. The step 7 is not working. I tried both ways (article’s and yours). Just not sure what’s going on. It keeps on giving error message: “The requested URL was not found on this server.”
    “Apache/2.4.41 (Ubuntu) Server at YOURDOMAINNAME.com Port 80.” whenever I try to access any admin panel menu.

    The /etc/apache2/sites-available/000-default.conf file has the block that is pointing towards /var/www/html. Not sure why the page is unable to find the pages. The following block is added in the 000-default.conf file before error log. Any idea?

    Options +FollowSymlinks
    AllowOverride All
    Require all granted

  6. Hi Hassan,
    I stuck at command: mysql –u root -p
    It not worked. It showed:
    “Could not find command-not-found database. Run ‘sudo apt update’ to populate it.
    mysql: command not found”
    Please help me solve it!

    1. Hi Truongwinner
      Did you solve your problem, because I’m in the situation of your I cant lunch the database?
      Please tell me how to solve it if did solve it! Thank you

  7. i have setup all step by step but when i on (Database Installation) its says SQLSTATE[HY000] [1044] Access denied for user ‘@’localhost’ to database ”
    please let me know how i fix it ?

  8. Is it possible to host 2 different domains on one single VPS server running their own scripts?

    How would one test the max resources needed to run both these scripts?

  9. I accidently deleted winscp folders site enable and site available , and i lost all progress and is unabe to access the webpage now. Please Help

  10. Hi guys need help after getting full access of Maintenance Settings Control panel it is still redirecting to admin/install/install.php why is that

    1. Hello, After installation delete the install folder. /var/www/html/admin/
      after open admin folder go delete the install folder.

  11. Hello, After installation delete the install folder. /var/www/html/admin/
    after open admin folder go delete the install folder.

  12. I have one query, for the operating system you choose ubuntu 18.04 but mine is windows 10…….so what should I select from the list??

  13. Dear Hassan.

    Thank for your help and your tutorials. I am following step by step your tutorial but i`m having troubles with the maintenance section. I’ve done it excatly as u explained in youtube video i change the 00.default.conf and in the vps i run the command : sudo a2enmod rewrite. and still i cannot go to the maintenance mode.

    Not Found
    The requested URL was not found on this server.

    Apache/2.4.41 (Ubuntu) Server at

    Can u please give me a hand?

  14. Guy i really need some help with A To Z SEO tools this scrip is making me crazy i can’t access the user interface each time i type may Url it will open the installer panel
    pls i need some help

  15. hello hassan im following all your steps one by one but now im stuck with putty when i type the commands it says command not found and im stuck there plz help

      1. hello hassan, all of your steps worked perfectly, i actually downloaded a script named all in one videodownloader from code canyon but now i am stuck on installation page. where i have to add all the details like my website url and hostname, database user, database name and password. i entered all the required information correctly and now it shows could not connect to database please check credentials. no matter how many time i try it always shows the same thing i tried reinstalling whole scriptp and reinstalling ubuntu again on my contabo vps but nothing is working

        1. Hi Hassan. I have follow your step by step but I got stuck, After finishing creating the database, check it on google but nothing shows up this what google gave to me……No documents match the specified search terms ( http // mysoftwaretoo.com / index.php ).

          Suggestions:

          Check the spelling of the search terms.
          Try other words.
          Use more general keywords.

  16. hey i was configuring apache and done everything as shown in these step but still script is not working
    it is showing this error
    Not Found
    The requested URL was not found on this server.

    Apache/2.4.41 (Ubuntu) Server at atoz-seotools.net Port 80

  17. Hello
    I had finished all installation but when I go into the website enter me to the installation page again
    kindly I need your support to fix this issue

  18. Hey, It was really helpful, but I am having trouble in the Let’s encrypt installation section. Can you make a video on that topic?

  19. Hi! When I got to the Contabo page, the packages were not showed like in the video so I ended buying a VPS 300
    IP: 93.104.212.206
    IPv6: 2a02:c205:2058:3949::1
    Location: Munich
    VNC: 178.238.229.15:63086
    Host system: 2525
    OS: Cent OS 8 (64 Bit)
    Panel: LAMP

    Is it a problem not to have the Ubuntu server?

    I am already at “http://seotoolsbr.shop/admin/maintenance” but the error that I have is different “404 Not Found
    The requested URL was not found on this server.” How can I fix this error?

  20. Hello sir, Mr. Hassan
    I am pleased to inform you that I am one of your followers, and I thank you for your efforts in providing everything that is useful and beneficial to your followers.
    And I started a PHP website project, and I purchased the program from CodeCanyon, I subscribed with Kentaboa, and I bought the domain name from NameCheap through the links attached in the video, and I did all the necessary steps to download the programs until I reached the download of the database, so I faced this the problem
    I open Putty and enter the Server IP and password, to Create a MySQL Database. But every time I enter this command ( mysql -u root -p ) I Received this message :
    (could not find command-not-found database)
    the screenshot is attached.
    Please advise what to do in this case
    Thank you

      1. I try but don’t know how and where to post in the forums it’s complicated.
        I urgently need help with this, I’m stuck after spending all that money.

  21. Dear sir,

    after install, I was logged in to the admin page, in the admin panel I was navigated to all option is showing ” Not Found
    The requested URL was not found on this server.” kindly guide me.

    server in AWS

    os: ubuntu-focal-20.04-amd64-server-20210430
    inbound rules: all port is allowed.

    apache2,PHP 7.4 , my SQL server, database created.

  22. Dear i am stuck here please help. Thiis is the last step
    Not Found
    The requested URL was not found on this server.

    Apache/2.4.41 (Ubuntu) Server at smartseotoolset.com Port 80

  23. i’ve done all the settings as you’ve shown in video. but whenever I click on maintenance mode it shows ‘requested URL was not found on this server’

  24. Dear brother Hassan, thanks a lot for you detailed guidance. love from Dubai. I have followed all above commands and instruction. now I have my own website http://www.e-seotools.com (all credits goes to you). I bought AtoZ Seo script.

    now login/signup/contact us email not working. please guide me.

  25. What you do in your Youtube video for step 7 and what you say here to do is 2 completely different things. Please show the correct way. I can’t manage my site or anything in dashboard due to this. Only getting “Page not found”. Tried the way you tell to do step 7 in this blog and the way you show how to do it on youtube, but it simply does not work…..

    1. Hello friend,
      Each script might be slightly different to install, this article is the general needed instructions to run the script.

  26. Hi Sir Hassan.

    Im from Pakistan and being a your student Im very happy. I was trying to publish my VPS website in codecanyon script. But in the following error im stuck in site maintenance. God mercy on you. Please guide me.

    Apache/2.4.41 (Ubuntu) Server at seoanalysts.co Port 80

  27. Hello, I have a problem, which is that when I log in to the site with an addition indexphp
    The application settings are not entered, what is the solution please?

  28. I have a problem that I want to solve
    When I click on maintenance mode, a page appears that the server is not recognized
    What is the solution
    I did all the solutions I mentioned in the video and the site is still unable to put maintenance

      1. Dear Hassan,
        How to implement the google ad-sense script inside the script PHP website, please guide step by step to enter the script in the header section of the website in the contabo server.

  29. hello! so I followed your video on this same thing^. and I completed everything as you told me but I’m getting an error and its keeping me from the maintenance panel. so please advice

    P.S. I got an email saying I have to verify my email or else I will lose my domain in a couple of weeks. I don’t know if that has something to do with the error I’m getting but since I don’t know anything about developing, I’m starting to panic a little bit

  30. hi i need help with this please i run the codes on putty .still not working i can not surf through the site
    Fix URL Not Found Problems 39:07

  31. Hi, thank you for sharing your knowledge!

    I did everything exactly like you explained it on your youtube tutorial, but for some reason I cannot get the back end of my site to work properly. Any link I click on takes me to an error page. I did this “Configure Apache to Publish PHP Website” step exactly how you showed in your video, and yet I still have trouble when i click on site ‘maintenance’ under manage site in admin dashboard 🙁

    please help!

  32. Hello friends, I tried to practically follow up every thing.
    However, I found some challenges like to step up my os and credentials in contabo.
    So my question is:
    How do I setup my os and credentials in contabo after a complete purchase of the order?
    Thanks friends.

  33. Hi Hasan. I’m one of your biggest fans!!! Say Hasan, I know that you have a $69.00 PHP Code Canyon Script Setup Service. Is there a possibility that, for an extra fee, you can setup my script within 24 hours??? I need a script to be up and running no later than Tuesday morning (EST) Feb. 16, 2022. If yes, how much?? Thanks Hasan.

  34. Hi, I went ahead according to your instructions and encountered two problems:
    1- There was no folder called www in the var folder and I created this folder www, html manually and put the upload file inside and went through all the steps correctly via putty
    2- After completing the steps in this step:
    Visit the “index.php” page in your web browser where you have uploaded the files e.g. http://www.example.com/index.php
    I paste the site I created and open it, it gives an error that the address is wrong or check your internet
    where is the problem from?

  35. Hi everyone , i just purchased a php script ,vps and a domain and i followed Hasan’s tutorial i extracted the files to /var/www/html the problem is when i say domainname.com/index.php or install it will say file not found but it does exist

  36. I followed your instructions and successfully create the website but I ran into an issue. I cannot get the sitemap to generate because of permission issue, how do I go about that?
    Thanks in advance for your reply.

  37. Thanks for the great article, I followed each and every step but step 10 won’t work, it says the command doesn’t exist. Pls, update it if anything else is missing.
    I need help on how to visit my PHP hosting website. Every browser I used to visit the site points me to the admin area that requires a login. I want to be able to visit it like anybody visiting the site from a search engine or through the browser. Briefly, I bought a PHP script from CodeCayon and configured it with my VPS hosting. After configuration with PuTTY, I connected to the admin area, but anytime I try visiting the site to see what it looks like, it takes me to the admin area. I’ve tried a different browser, yet the same result. What am I doing wrong? Please, help.

  38. Hello, when I install the script watching your video and doing all the steps it indicates, I get these errors at the end if you can tell me why this happens:

    Multibyte String (Mbstring) Unavailable
    GD Extension Unavailable
    CURL Extension Unavailable
    XML / DOM Extension Unavailable
    If I don’t correct those errors, I can’t continue with the installation.

  39. I faced this error when i tried to create a mysql database , if you could help please !!

    ERROR 2002 (HY000): Can’t connect to local MySQL socket’/var/run/mysqld/mysqld.sock'(2)

    PLEASE HELP !!

  40. I get an error 404 when clicked on the maintenance page, tried following all the steps to configure apache server and changed conf file.