Understanding Server Side Scripts

PHP is a server side script.  That is it must be run on a web server that supports PHP.  Your PHP web pages are  generally saved with the file extension ‘.php’.  With PHP on the web server any requests for a page with the ‘.php’ file extension will lead to the page been passed through the PHP interpreter before been passed to the browser.  To the PHP interpreter PHP code will be distinguishable from HTML as it is enclosed in the following tag <?php …………………….. ?>.

Note: You can use the ‘.html’ file extension for PHP pages as well.  This can be useful to ‘hide’ which server side language you are using.  This can be done by adding a .htaccess file to your web site.  See php.net for more details.

At the client end (the browser) the source code of any given PHP page will reveal nothing about the PHP code used to create it.  Only HTML (or client side Javascript) is actually sent to the browser.  PHP is described as a server side script as the interpretation of any PHP code is done by the server NOT the browser.  Javascript is an example of a client side script as the Javascript code is interpreted by the browser – and as such visible in the source code of the page.

This means that PHP pages cannot be tested without access to a PHP supporting web server.  You have two options:

Option One: Running Your Own Copy – To do this you will need access to a web server (or know someone who does).  You could then download the PHP application from php.net and install it on the web server.  On the php.net site you will find all the necessary files to install PHP on a UNIX/Linux or Windows web server.   You will also find supporting documentation as to how to install the software.

Note:  Installation is relatively straight-forward but is non trivial even for experienced web server administrators.  Read the documentation carefully, take your time or even try a practice install on a non-production server before attempting the install.

Option Two: Obtaining PHP Supporting Web Space – A more straightforward solution is to buy web space from a hosting company whose technical staff have already installed and configured PHP on their web server.  Many hosting company packages will come with PHP and MySQL installed and ready to run.  The better hosting companies will also provide a web interface to maintain your MySQL database – of which PHPMyAdmin is a popular choice.

Using MySQL

As mentioned previously MySQL is an open source database.  In order to run a MySQL database the MySQL application has to be installed on your web server as with PHP outlined above.  It may be the case that you choose to install MySQL on different server to your web server.  That is certainly the case with commercial hosting companies where you PHP pages on held on one server but your MySQL database is held on another.  If you intend to replicate this set up (which has obviously security benefits) then you need to ensure that your web server and database server are networked in such a way that they can speak to each other.  It is no use having a securely firewalled database server which your PHP web server cannot pass and receive data from.

The database you use exists only on the server.  MySQL is not a ‘file’ based database application like Microsoft Access.  There is no single file like the Microsoft Access ‘.mdb’ file that represents the database.  Rather there are a series of files making up the database held on the database server.  With a hosted account you will not always have access to the files themselves and thus have to rely on the hosting company to perform data back ups, although there are techniques to back your data up.

MySQL Database Tools

The straight installation of MySQL will enable you to build a database using a command line prompt.  This requires a working knowledge of SQL.

Alternatively there are many tools available to help you.  These include MySQL Administrator, MySQL Explorer, MySQL Front, Navicat and the above mentioned phpMyAdmin.  Some tools like Navicat are not free and have to be purchased.  Some are also only of interest to server administrators.  As mentioned earlier phpMyAdmin is a free tool and is web based.  This means it can easily be made available to web application developers and as such is a popular choice amongst hosting companies.


XAMPP is an easy to install application that contains MySQL, PHP and phpMyAdmin.  It can be installed on Linux, Windows and MAC OS.  It is also free. XAMPP is perfect for setting up a test environment in which to build and test your PHP/MySQL applications.  You cannot use XAMPP as an alternative to a hosting company – it is designed as a test environment.

Leave a Comment