What is PHP?
PHP:Hypertext Preprocessor or simply known as PHP is an open-source general-purpose scripting language that is widely used for web developments and can be embedded into HTML. Unlike other scripting languages like C or Perl which uses lots of commands to output HTML, a PHP page contains HTML with embedded code that is enclosed in a special start and end processing instructions, , that allows you to jump in and out of the “PHP mode”.
It works by executing the code on the server, generating and HTML which is then sent to the client. The client would then receive the result of the running script without knowing what the underlying code was.
How can you tell if your server has PHP support?
Although almost all servers, like those using Linux platforms already have PHP installed in them, it is always best to check whether your server does have PHP support or not. To find out, you need to do the following; first, you need to create a new file with a .php suffix, say for example checkphp.php. Next, type the following code into your file: Code:
and then upload it to your web server using FTP. Using your web browser, go to the PHP file, with the URL http://localhost/checkphp.php. If your browser will display a page full of information about the PHP version and its configuration including all the information about your web server and your system in general, then your server has PHP support. But if your browser simply displays a blank page, then you’ll know that PHP is not supported by your server. One important thing to remember after you checked your PHP support is to delete the folder or the file, say checkphp.php, to prevent other people from running the script and obtaining sensitive information about your system.
I am using Windows, can I add PHP support if my server does not support it?
Yes, you can add PHP support simply by installing PHP into your system. And should you decide to add PHP support, I would recommend using the PHP 5 package. You need to follow the following steps for you to add PHP support to your system:
- Download PHP from http://www.php.net/downloads.php. Make sure that you select the PHP for Windows.
- Install the file simply by following the instructions. Choose “None (or other web server). I will configure the web server manually” if you are prompted about the type of your web server and then proceed with the installation process.
- Open your server’s console and in the Hosts table, press Configure in the row which corresponds to the host where you want to add PHP support.
- Select Scripting Parameters.
- Then check Enable Scripts Extension.
- In the Interpreters table, check Add.
- In the Interpreter field, press browse and proceed to the directory where PHP is installed and click on php-cge.exe.
- Set the type to Standard and check the Use the associated extensions to automatically update the Script paths.
- In the Associated Extensions table, press Add.
- Then enter php in the Extension field and then press OK.
- Press OK and the Press Add in the Custom Environment Variables table.
- Enter REDIRECT_STATUS in the Name field and 200 in the Value field and press OK.
- In the Scripting Parameter dialogue, press OK.
- Select Index Files.
- Then press Add in the Index Files table and enter index.php in the File Name field and press OK.
- Press the Restart button to restart the server.
What are the advantages of using PHP?
The following are the advantages of using PHP:
- PHP is free.
- It is easy to use and user-friendly.
- It can be easily embedded into HTML.
- It is compatible with both Linux/Unix and Windows platforms.
- It is stable and fast.