PHP is one of the most used server-side scripting languages.
The website on which you are reading this article is created using WordPress. WordPress is written in PHP.
Using PHP, you can make any type of website; From a simple blog to complicated and huge sites like Facebook (It was built in PHP too!).
In this article, I am going to show you how you can host your custom PHP application on your VPS using ServerAvatar.
I have divided this article into multiple steps to make it easier to understand the process. It’s not hard, It’s a very easy process. So, the steps to host your custom PHP application on your server using ServerAvatar are:
- Creating a blank PHP application
- Uploading Files using FTP
- Creating a database for your PHP site (Optional, Only if you app needs database)
If you are just trying out ServerAvatar and want to understand how exactly you can host custom PHP application using ServerAvatar, I have created one simple PHP application with a simple layout made in bootstrap and small parts of the website included in the main pages. Click here to download the sample PHP site.
Creating a blank PHP application
Now, Let’s create an application in ServerAvatar. To create an application in ServerAvatar, First, you have to connect your server. If you already have server connected, Click on the CREATE link given in the applications card on Server Panel.
On the new page, you will see one simple form to enter the name of the application, Domain name of the application and the type of the application.
In the Application name field, Enter the nickname of the application. In the Domain/Sub-domain field, Enter the domain/subdomain on which you want to deploy this PHP application and in Application type drop-down, Select Custom if you want to host custom PHP application.
Make sure your domain/sub-domain is pointing the IP address given in the helper text below the Title of the form. It’s the IP address of the server on which you are creating an application. It’s not mandatory to create application but it’s mandatory for installing SSL using one-click option.
Once your application is created on the server, you will be able to see something like this on the domain/subdomain URL if your domain/sub-domain is pointing the correct server.
Now, we have to upload our PHP application on our server. We will use FileZilla to upload our PHP files on the server.
Uploading Files using FTP
You can find SFTP information on Application dashboard. You can navigate to Application dashboard from Applications page on which you will get a list of your applications. Each application will have a Dashboard button.
On Application dashboard, you will find SFTP information just like the following image.
Now, Connect to the server using the SFTP information given on the application dashboard and click on the application directory. Inside the application directory, you will find three directories. They are:
- Conf – You can upload custom Apache configuration files in this directory and it will be automatically included in the application’s apache configuration.
- Logs – This directory contains the access and error log files of the application.
- public_html – This directory contains the website files. We have to upload our custom PHP application inside the public_html directory.
Once you are in the public_html directory, The remote site part of your PHPMyAdmin should look like the following image. The public_html directory is populated by one file called index.html by default. You can delete the default index.html if you want.
Now, on the left side, On the local site, select all the files and folders by using the keys
CTRL + A , right-click, and click on the Upload option.
It will upload all the files in the server’s public_html directory. Once done, delete the default index.html file if you haven’t deleted it yet.
The application we just uploaded looks like the following image!
So, this is how you can create your own PHP application using ServerAvatar. If you were following the tutorial, your custom PHP application must be up and running right now.
If your custom PHP application is not up and running yet, just comment down the error you are facing and we will help you solve the issue.
If you are trying to setup a WordPress website on your server, you can follow this tutorial as there is no need to do anything manually in that case.
Creating a database for your PHP Website
Every website needs a database to store information that is generated through the website by website users. The site we just uploaded does not need a database as there is no way to generate new data in that custom PHP application.
To create a database, Just click on the CREATE link given in the database card on your Server Panel. On the new page, you will see one modal that looks like the following image.
Enter the name of the database in the Database Name field.
If you want to pre-define the Username and password to access your database, Click on the first checkbox given after the Database name field. It will allow you to enter the username and the password to access the database. If you don’t want to define it manually, ServerAvatar will generate random credentials and will E-mail the database credentials.
Once the database is ready, you can just enter the database information in your PHP website configuration and it will start working with the database too!
Conclusion: Deploying custom PHP websites using ServerAvatar is very easy. However, Filezilla is more used to modify files than uploading files. If your PHP application has more than 100 files, You can use other FTP clients that provide zip/unzip feature as you won’t be able to unzip in Filezilla and uploading more than 100 individual files using Filezilla will take ages.
If you have questions, you can comment down in the comment section. We will help you resolve your questions, errors and queries as soon as possible.Sharing is caring 🙂