How to make Money by Publishing a PHP website that includes (CodeCanyon ) scripts.

If you've purchased a PHP script from https://codecanyon.net and need guidance on installing it, or if you're a PHP developer looking to understand how to publish a PHP website online, you've come to the right destination.

How to make Money by Publishing a PHP website that includes (CodeCanyon ) scripts.

In this comprehensive guide, I'll address the following key topics:

  1. Choose the Right CodeCanyon Scripts.
  2. Purchase and Download the Scripts.
  3. System Requirements.
  4. Acquiring a Domain Name.
  5. Procuring a VPS Server.
  6. Mapping the Server IP to Your Domain.
  7. Creating a MySQL Database for Your Application.
  8. Uploading Files to the Server via WinSCP.
  9. Installing Essential PHP Modules.
  10. Efficiently Managing MySQL Databases.
  11. Configuring and Managing Cronjobs.

Step 1: Choose the Right CodeCanyon Scripts

The first step towards creating a profitable PHP website is selecting the right CodeCanyon scripts. Spend time researching and ensure the chosen scripts align with your website's purpose and target audience. Look for popular, well-maintained scripts with positive user reviews.

Here is the Link:

https://codecanyon.net/

Step 2: Purchase and Download the Scripts

Once you've identified the scripts you need, purchase them from CodeCanyon. Make sure to obtain the appropriate licenses for each script. After purchasing, download the script files to your local machine.

Step 3: System Requirements.

Requirements to Publish PHP Website:

  1- Domain Name

  2- VPS Server 

To get your website up and running, you'll need a hosting provider and a domain name. Choose a reliable hosting service that supports PHP and MySQL databases. Register a domain name that reflects your website's content and purpose.

         1- Domain Name

  • Acquiring a domain is as effortless as indulging in a slice of chocolate cake.

         I highly recommend selecting a domain name that aligns with your business. If you already possess one, which I assume you do, feel free to skip this step and proceed with obtaining a VPS                     server.

        But how to obtain a Domain ?

  • All you need to do is visit a domain registrar company such as Godaddy, Hostinger, Enom, Freenom, Namecheap, and purchase a domain name. You can even find one for as low as $1 per year.

    2- VPS Server 

  • Obtain a VPS Server:  Next, it's time to secure our VPS server for the configuration of our PHP script.

       What is a VPS Server? When you're preparing to launch a PHP website, script, or any web application, you engage in what we refer to as "web hosting." This essentially involves uploading your             files and databases to a public server, making them accessible online over the internet.

Exploring Web Hosting Options:

When it comes to hosting a web application, such as WordPress, you typically have two main choices:

  1. Shared Hosting: Shared hosting involves hosting your website on platforms like GoDaddy, Bluehost, or Hostinger. With this option, your website shares server resources with numerous other websites on the same server.

  2. VPS Hosting: With VPS hosting, you have the opportunity to host your website on your very own server, known as a VPS or Virtual Private Server. This means you have exclusive access to the server's resources.

Which Option Is Better?

To keep things simple and avoid delving into technical details, it's safe to say that VPS hosting is the superior choice. With VPS hosting, you gain full server manageability and enjoy enhanced performance.

If you think shared hosting is significantly cheaper, think again. Contabo offers VPS services starting at just 3.99 € per month, which is on par with the pricing of nearly 90% of shared hosting services.

Perhaps the only potential drawback is that VPS hosting may require a bit more technical expertise for setup and configuration. Thankfully, you're here with this step-by-step guide to make the process smooth and straightforward!

Which Hosting Company Should You Choose?

You have the flexibility to select any company for purchasing a VPS server. In this guide, I'll introduce two companies that I believe offer comprehensive services at the most competitive prices. I personally manage more than 10 servers for my business through these companies:

  1. Contabo
  2. Digital Ocean

However, the choice ultimately rests with you, and you can opt for a company that suits your comfort level. Hostinger is also a viable option, offering competitive pricing compared to other providers.

Note: This tutorial will specifically demonstrate how to acquire a VPS server from Contabo.

Now, let's explore the process of obtaining a VPS server from Contabo.

1: Open Contabo Website.

Open your web browser and navigate to Contabo VPS Page.

You'll encounter various VPS configurations initially. To begin, you can opt for the most economical option to install WordPress, which will be more than sufficient.

As your business expands, you can consider upgrading to a more robust VPS with increased resources.

Step 2: Configure VPS Settings On the following page, you will be prompted to make specific selections.

Under the "Image" choose Ubuntu 20.04

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

Adding PTR (Pointer) Record: If you are asked to provide a PTR record, simply enter your domain name, and that's all you need to do.

Now, proceed to the billing page and confirm your order. I believe the remaining steps are straightforward and self-explanatory.

Within approximately 24 hours, the Contabo Team will set up the server and send you the details via email, similar to this format:

Step 3: Linking Your Domain Name to Your VPS Server

Alright, now that we have both a domain and a VPS server, it's time to connect them!

While your VPS server can currently be accessed via the IP address shared by the Contabo Team through email, we don't want to rely on using just an IP address to access our WordPress website. Instead, we want to use our domain name.

To achieve this, we'll map the domain name to our VPS IP address, allowing us to access the VPS and the WordPress website using both the domain and the IP address.

Configuring Your DNS Records: Simply access the DNS management zone provided by your domain provider (in my case, it's Namecheap), and modify the primary A record as follows:

1.      Sign in to your Namecheap account.

2. Select Domain List from the left sidebar and click on the Manage button next to your domain name:

3. Click on the Advanced DNS tab and find the Host records section. Then click on the Add New Record button:

 4 .Now add two A records for @ and www hostnames pointing to the IP address received for your domain from Weebly:

                                           

                                     

 NB! The A record value is provided above as an example. The correct one should be checked in your Weebly account.

 

Save changes using the corresponding green button. Normally, it takes 30 minutes for newly created host records to take effect.

 NOTE: It might take up to 48 hours for these changes to fully propagate on the Weebly side. During that time the website may not be available.

 

Step 4: Establish a MySQL Database for Your Application

In order to host a PHP website, the majority of PHP scripts and applications will necessitate a MySQL database. Therefore, let's go ahead and create one.

Begin by connecting to your VPS server using an SSH client such as PuTTY. Now, let's get started!

Simply launch PuTTY and input the Server IP or Name, then click on "Open."

You'll be prompted to log in; just use "root" as the username and enter the password provided to you via email.

Please note that while typing the password, PuTTY won't display it for security reasons, but rest assured, it's registering your input as you type.

Logging In with PuTTY:

  1. Launch PuTTY and input the Server IP or Name, then click "Open."
  2. You'll gain access to the server.

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

    mysql -u root -

  1. Enter the root password when prompted, and press Enter.

  2. First, create a separate database for your PHP application. You can choose any name, but for this guide, we'll use "TestDb" to keep it simple. Execute this command:

  CREATE DATABASE TestDb DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
  1. Next, let's create a distinct MySQL user account exclusively for operating on our new database. Creating dedicated databases and accounts is a wise approach for management and security. In this guide, we'll use the name "DbUser." Feel free to change it as needed.

    Create the account, set a strong password, and grant access to the database using this command:

CREATE USER 'DbUser'@'localhost' IDENTIFIED BY 'enter_a_custom_password_here'; GRANT ALL ON TestDb.* TO 'DbUser'@'localhost';
  1. Flush the privileges so that the current MySQL instance recognizes the changes:
     FLUSH PRIVILEGES;
  1. Exit the MySQL environment by typing:
    EXIT;

Done! ✔️

Uploading Script Files to the Server: To upload the files, you'll need an application called WinSCP. It's a free tool you can download here.

    6.Connect to your VPS Server using WinSCP and upload the PHP files to this path: "/var/www/html."

If the files are in a zip format, you'll need to extract them. To do so in PuTTY SSH Client, follow these commands:

  sudo apt-get install unzip # Install the unzip utility clear # Clear the PuTTY screen cd /var/www/html # Change directory to /var/www/html unzip
  YOURFILENAME*.zip # Unzip the file (replace YOURFILENAME with your file name)

Now, move the contents from the latest folder to the upper directory so they can be accessed directly using WinSCP. Simply copy all the files inside the "YOURFILENAME" folder and paste them directly into the "html" folder.

Files uploaded. Done! ✔️

  1. Installing PHP Modules for Publishing PHP Website (Optional): Some PHP applications may require additional PHP modules on your server (this will be specified in the app's documentation).

    To install additional PHP modules, open PuTTY and run the following commands:

  sudo apt install php-curl sudo apt install php-mbstring sudo apt install php-example # ... sudo service apache2 restart # Restart the Apache service

Done! ✔️

  1. Configuring Apache to Publish the PHP Website: Congratulations! Your files are now uploaded and placed in the "html" folder. We need to configure Apache so that we can publish your PHP website and access your script using your domain name.

    To do this, open WinSCP and navigate to the directory: "/etc/apache2/sites-available/"

    Create a new empty file and name it "yourdomain.conf." You can replace "yourdomain" with any name you prefer (below is an example naming it "mautic.conf")

Creating the Configuration File:

  1. Open the "yourdomain.conf" file and paste the following content into it. Save the file.
ServerAdmin admin@YOUDOMAINNAME DocumentRoot /var/www/html ServerName YOUDOMAINNAME ServerAlias YOUDOMAINNAME Options +FollowSymlinks AllowOverride All Require
all granted ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined
  1. Replace "YOUDOMAINNAME" with your actual domain name.

Enabling Your Script Configuration in Apache and Restarting the Service:

  1. Now, execute the following commands to complete the setup:
 sudo a2ensite yourdomain.conf sudo a2enmod rewrite sudo systemctl restart apache2.service

Congratulations! You're almost done.

  1. Connecting to the MySQL Database:

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

  3. You should see the setup completion wizard. Follow the instructions to enter the database information and your admin login details. For example, if you created the database "TestDb" and the user "DBUser" with a password, provide these details.

Connecting to the database. Done! ✔️

  1. Setting Up Cron Jobs:

Cron jobs are scheduled tasks that can automate various functions on your server.

To set up cron jobs:

  1. Open WinSCP and navigate to the "/etc" directory.

  2. Locate and open the "crontab" file using the editor.

  3. Paste all the necessary cron jobs from your script's documentation into this file. Each job should be on a separate line, with an empty line at the end.

Setting up cron jobs. Done! ✔️

  1. Securing with a Free SSL Certificate:

SSL certificates encrypt the traffic between your server and users, enhancing security. Let’s Encrypt provides free, trusted SSL certificates.

To secure your server with Let’s Encrypt:

  1. Connect to your server using PuTTY SSH client.

  2. Install the Let’s Encrypt client, Certbot, by adding the repository, updating the package list, and installing Certbot's Apache package:

 sudo add-apt-repository ppa:certbot/certbot sudo apt-get update sudo apt-get install python-certbot-apache
  1. Generate an SSL certificate for your domain (replace "YOUR_DOMAIN_NAME" with your actual domain):

  sudo add-apt-repository ppa:certbot/certbot sudo apt-get update sudo apt-get install python-certbot-apache

  1. Follow the prompts to provide an email address and choose whether to enable both HTTP and HTTPS access or force all requests to redirect to HTTPS.

That's it! Your website should now be SSL-encrypted.

Done! ✔️

Just try it ....

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow