Knowledgebase

How to Install a PHP Script in cPanel?

As the topic suggests, this knowledgebase will deal with installing a PHP script in cPanel.

Before moving further with the topic, it is essential to know a bit about PHP.

What is PHP?

PHP (Hypertext PreProcessor) is an incredibly powerful scripting language that works on the server side. Users can create dynamic, interactive, and secure websites and applications. PHP is the most popular open-source scripting language used in web development today. You will be amazed to know that complex applications like WordPress and Facebook are built on PHP (along with other supporting languages and elements). 

Users can write effective code quickly while utilizing minimal resources. With PHP, developers can create robust websites with advanced functionalities in less time than with other languages. PHP supports MySQL as its database to store information so that you can create MySQL codes within PHP without any flaws. Besides MySQL, PHP supports other databases like PostgreSQL, SYBASE, IBM-DB2, and Oracle.

The simple and easy-to-implement module within PHP that manages the MySQL database is called phpMyAdmin


Also Read: How to Create a PHPinfo File and View PHP Information?


How to Install a PHP Script in cPanel? 

Installing a PHP script within your cPanel involves the following steps. Let’s have a look at them.

  1. You must log in to your cPanel using the credentials first. If you are unaware of the credentials, you may approach your web hosting provider, and they will help you get through.

As an example, to explain things in a much better way, we will install one of the most popular PHP scripts, i.e., WordPress

Let’s begin with the Installation!


Also Read: Ultimate Guide to Fix Internal Server Error in WordPress


Method to Install WordPress Script in cPanel

Before proceeding, it is essential to understand the installation of WordPress in your cPanel. 

Begin first by downloading the latest (updated) version of WordPress from the official WordPress website. The setup will be downloaded as a zip file. You must save this file to your computer’s desktop or an easily accessible location.

Install WordPress Script in cPanelLocate the WordPress zip file and extract the entire content to a folder.


Also Read: How to Upload HTML files to Your WordPress Website?


Install the PHP script on your server

  1. Login to cPanel
    Login to cPanel
  2. From the visible tools, select your “File Manager” and open it.
    select your File Manager
  3. Search for the “public_html” directory.
    select public_html directory
  4. Click on the “Upload” Option on the top
    Click on the Upload Option
  5. Now, Click on the “Select file” Button & choose file
    Click on the select file
  6. Wait for the 100% Upload
    Wait for the 100% Upload
  7. Now, You will see the zip file of WordPress inside the public_html folder
    see the zip file of inside the public_html folder
  8. Right-click on the file & click on “Extract” to extract the zip folder
    extract the zip folder
  9. A pop-up window will open to enter the path you wish to extract the files. As we are doing this in public_html folder, the path will be shown same as this. Click on “Extract files
    path you wish to extract the files
  10. After extracting, A pop-up window will appear with extracted files shown in it; You don’t need to do anything, Just click on the “Close” button
    After extracting
  11. Now, you have to create the database. For this, Go to the cPanel main page & Click on “MySQL Databases” to build your database. 
    Click on MySQL Databases
  12. In that, You may enter the name of your choice in the blank space below “Create New Database” and click on “Create Database”. The process of building the database has been done. 
    Create Database
  13. Click on “Go back” to create a userClick on Go back to create a user
  14. To create users for “MySQL”. Go to “MySQL Users” and type the username. Ensure the username comprises alphanumeric characters. Moreover, mention a (strong) password for this user. The strength meter will show you the password strength. The stronger, the better. The password strength must be above 40/100. 
    To create users for MySQL
  15. After adding, click the “Create User” button once you have successfully entered the username and password.
    After adding, click the Create User
  16. You must add the created user to the database for the script to work perfectly with the database. Scroll down on the same page. Go to “Add User to Database,” showing two dropdowns. Select the created user from the first dropdown. Select the database you created from the second dropdown. Click on the “Add” button.
    Add User to Database
  17. Select all the checkboxes in the “Manage User Privileges” section and click on “Make Changes”. Selecting “All Privileges” will allow the user full access to the database through the script.
    Manage User Privileges

    It’s successfully done! 

Also Read: How to access wordpress dashboard from Cpanel


Wrap up

Through this knowledgebase, we have explained the steps involved in installing a PHP Script in your cPanel. You would also have grabbed the idea of creating a MySQL database for your site, creating a user, and assigning him the necessary privileges.