How To Host Web Pages and PHP Scripts
To start hosting your web pages and PHP scripts, you will need to do the following things, in gist:
– Install a web server.
– Install the PHP interpreter.
– Configure the web server.
– Install a FTP server.
– Configure the FTP server.
– Install a database server.
– Configure the database server.
Installing is the easy part. Configuring is the hard part. However, “easy” or “hard” are relative terms, and it depends on your level of skill. If you are skillful, all of the above will be easy and you probably would not be reading this article in the first place. Thus, this article assumes that you are not skillful, in the sense that you have never done anything like build a Linux or Windows web server that runs hundreds of websites that can support common CMS like WordPress or Joomla.
First, you will need to acquire the needed skills to perform the above tasks. Skills take time and effort to acquire. The time and effort that you put into reading this entire article will certainly not suffice, but it will serve as a good start. (Wait! I do not have so much time! Is there a quicker way to do this?
There are several ways to install a web server. Typically, a command like “yum install httpd” or “apt-get install apache2” would get the web server (Apache in this case here) installed in a Centos and Debian server respectively. The same thing applies to the PHP interpreter, i.e. a command like “yum install php” or “apt-get install php” should work. For more details, simply Google the words like “install apache centos” or “install PHP debian” will yield a host of articles.
After that, you will need to configure the Apache server. This will be no easy task as the Apache server is a powerful web server with many configurable options. To make it work together with PHP is even harder; “harder” in the sense that that are many ways to make it work, and there are even more ways to make it not work. Most articles in the Internet (Google “apache PHP centos” or something similar) will show you some very basic configuration approaches, but those articles by no means describe the only method of getting it done. Most involve just leaving things in their default configuration, and simply upload the web pages and scripts to the default locations (and hope that it all works out well).
For Windows server, the default web server is IIS. Installing IIS almost feels like enabling something in a Windows server. Typically, you would go to ” Start -> All Programs -> Administrative Tools -> Server Manager”, then “Roles”, “Add Roles”, tick “Web Server (IIS)”.
The purpose of the FTP server is to allow you to upload web pages and scripts into your server. In a Linux server, there are many FTP server programs available, each with its own method of configuration. But for Linux servers, using FTP is not the only way to upload files. You can use SCP, which actually uses the SSH connection to upload the files.
Typically, in a Linux server, the database server would be MySQL. Just like Apache, there are several ways to get it installed. The most common way would be to use a package manager. Thus, a command like “yum install mysql-server mysql php-mysql” (for Centos), or a command like “apt-get install mysql-server php5-mysql” (for Debian) will get it done. During the installation of MySQL, you should be prompted to set a MySQL root password. Please do not confuse this with the server’s root password. The server’s root password allows you to SSH into the server, and perform administrator tasks like installing more programs. The MySQL root password allows you to log into the MySQL server as MySQL administrator to do things like create databases and users for the databases.end using MSSQL as the database server. However, please note that not all versions of MSSQL are free.
The above describes the things that need to be done in order to make server capable of running a web site with PHP scripts. But it is by no means complete. It only serves as a start.
Some of us may not have the time, energy and/or interest to explore the intricacies of all the “ingredients” needed to make a web server that supports PHP and MySQL. In case you are wondering, “Is there a program that installs and configures all these ‘ingredients’ for me, and then gives me a graphical user interface for me to easily manage the server? ” The answer is yes. It is called the “Parallels Plesk Panel”. The software is free to download and install, but you will need a license to get it to work.
Some of our pre-build cloud servers are installed with Plesk. If you intend to explore this option, you might want to consider changing the “Template” (aka Operating System) to something like “CentOS 6.3 Plesk 11 x64”, as illustrated in the picture below.
(Please note that changing the “template” or operating system of the cloud server will result in loss of data. Do this only when you have the means of re-uploading all your data.)
After that, you will need to “Rebuild Virtual Machine”, as illustrated below. (To repeat, this will result in loss of data. Do this only when you have the means of re-uploading all your data.)