In this article, we will learn how to install PHP script on cPanel without stress easily.
Before proceeding, for perfect understanding, it will be necessary to talk a little about PHP and cPanel.
What is PHP
PHP stands for Hypertext Preprocessor. It is a server-side programing language and the most used in the web environment. Most websites we see on the internet today runs on PHP.
PHP makes use of the MySQL database to store its information. This means that one can write MySQL codes inside PHP, and it will work fine without limitations.
Aside from MySQL, there are other database systems that can connect with PHP, in the likes of; PostgreSQL, SYBASE, IBM-DB2, and Oracle Database.
Using other databases will not be an issue, but you may not find it on the most shared hosting web hosting.
Although over 92% of PHP scripts you find online make use of MySQL, you still have to be sure of which yours is built on.
For the sake of this lecture, we will stick to MySQL. We hope you won’t have an issue with that.
The software that handles MySQL is called phpMyAdmin, which is built with PHP. It is in that you can manage your MySQL data. It is not complicated; it is user-friendly and easy to understand.
What is cPanel
cPanel stands for Control Panel. It is more like the operating system used on web hosting. The cPanel is Linux based, which helps to manage the interface of the web server.
cPanel has many tools from which most activities can be made on the web server. It is flexible and easy to operate.
CPanel manages over 95% of web hosting in the world today. It is preferable because of its simplicity in usage.
Now that we have had a little chat about PHP and cPanel, we can now go into the main deal on how to install PHP script on cPanel.
Steps to Install PHP Script on cPanel
- Login into cPanel with the credentials. The login will require a username and password. If you don’t have a cPanel yet, simply purchase a Linux hosting account from any reliable hosting company of your choice. After your purchase, your cPanel login details will be sent to you. For some hosting companies, you will have to log in from the client’s side. That should not be a problem; either way, it’s still taking linking to the same cPanel.
- After a successful login, click on “MySQL Databases” and create a database. Creating a database is as easy as giving it a name and click on “Create Database.” The system will automatically create a database with the name you entered.
- On the same page, you will have to create a “MySQL Users.” Scroll down the page, create a user, and give it a password.
- For your script to be able to work with the database, you will have to add the user you created to the database, which was first created. To do this, scroll down on the same page you will see where it’s written “Add User to Database” with two dropdowns. Simply select the database you created on the first dropdown, and select the created user on the second dropdown and click on “Add.”
- After clicking on “Add,” it will take you to another where you will have to check all the checkboxes and click on Make Changes. This will give the user full access to the database via the script.
- Return to your cPanel home page, and click on “phpMyAdmin.” The phpMyAdmin will open in a new tab.
- On the phpMyAdmin page, you will see the name of the database you created on the right side on your screen. Click on it on the middle top of you see “Import” also click on it.
- On the next page, you will have to upload the database of the script you are installing. If you are not sure of the database file of the script, you simply search for a file with .sql extension.
- Click on Choose File, choose your script database SQL file, scroll down, and click on “Go.” If the correct file was uploaded, the database tables would import automatically.
- Go back to your cPanel home and click on “File Manager.” It will open in a new tab. Go to the directory you want the script. For your primary domain root directory, you will have to go to “public_html” click on Upload, and upload the PHP Script into the directory.
- The script you uploaded is likely to be in a zip file. To unzip it, simply right-click on the zip file and click on Extract. The script will be in files or/and folders.
- Locate the configuration file on the script you uploaded and edit it by putting your “database name, database user, and database users password” you created earlier. If you are not sure of the configuration file, you may have to contact the author of the script. For most programs, they keep the configuration file as “config.php” or “database.php.”
- Finally, you can now enter your site URL on a web browser connected to the Internet and access your website.
I hope this step-by-step article was helpful. If you encountered any challenges, please indicate them in the comment section to get help from us.