Appendix B. Setting Up 3 Tier Client Server Environment

Table of Contents

Apache, MySQL, PHP
Prerequisites
MySQL setup under Windows
MySQL setup on OS X on a Mac
MySQL setup on Linux
MySQL irrespective of OS
Daily use of MySQL
Installation of Sample Database(s)

The client environment is already present on your computer, otherwise you couldn't use it. You need software for the tiers 2 and 3. In practical terms this means downloading and installing a package. The current recommendation is XAMPP for Windows, MAC and Linux based computers. The A is the web server Apache,, the M is the Database Management System MySQL, and the P is the programming language PHP.

In case you only need the Database Management System you may choose to get MySQL only. In that case you can still follow this guide, just ignore the references to Apache and PHP.

In the opposite case where you don't need the Database Management System you may install the package anyway. In that case you can still follow this guide through the installation. You don't make any of the adaptations for MySQL.

XAMPP may be downloaded from here .

When you are on the download page follow the instructions for download and installation. If you work on Windows, choose installation method A.

Stop all running programs (ie SKYPE) and install. If asked, make sure that you indicate that Apache and/or MySQL are cheked to run as services. It is free in terms of computer resources until you need the services.

Experience show that if you will do web work with PHP of the installation, you may experience permissions problems on Windows systems, even though you have designated yourself an administrator. My sources say that installing the package directly in C:\ will circumvent those problems.

Start the server from the XAMPP control panel. In the rare case when you are not working with databases, meaning primarily frontend work, you are done with this appendix now. Otherwise we now need to tweak a couple of settings for easier daily use.

Upon installation of the server we need two databases for tests and experiments. They may be downloaded as worldFK.sql, and cms0.sql by right clicking and saving in your personal root dirctory. If you don't know what your personal root is consult your terminal program.

In windows: click Start->write cmd, press enter the terminal prompt reveals your root folder, something like C:\Users\<your name>

In OS X on a Mac: Start terminal, again the prompt tells you something like: /Users/<your name>

Now, start terminal emulation from your root directory, and then invoke mysql as follows (enter at the end of each line):

mysql -u xxxx -p
yyyy

create database cms0;
use cms0;
\. cms0.sql
commit;
select count(*) from page;

create database world;
use world;
\. worldFK.sql
commit;
select count(*) from country;

Please notice the commit; immediately after the program reads the data. When that is done you may write the select-sentence.

If you get the answer 239 from the world database, and the answer 5 from the cms0 database everything is fine. Leave the program with

quit

Quit the terminal window.