In this appendix we will walk through downloading, installing, and setting up the XAMPP package. XAMPP is a free package that has a collection of free applications assembled to provide you with an easy-to-set up web server (Apache), database server (MySQL), and server-side scripting language (PHP). XAMPP lets you experiment with these technologies and develop your own web applications.
Setting up an AMP (Apache, MySQL, PHP) environment has typically required configuring the different applications to work on their own, and then to work with each other. With XAMPP this interplay has already been set up for you, and the system comes ready configured and ready to go. In addition to being easy to get started, XAMPP includes a number of useful extensions, code libraries, and other applications, all already configured so you don't need to spend a long time trying to get them working together.
Note
Note that we are installing XAMPP here as a 'development' or 'testing' environment only. We will only be using XAMPP for testing and exploring the technologies, and not as a 'production' environment for serving our website to the outside world. Setting up a production web server and a database server, and securing and optimizing them is a topic beyond the scope of this text.
There are versions of the XAMPP package available for Windows, Linux, Mac OS X, and the Solaris operating system. XAMPP is free to download, and the package contains the following:
The AMP environment of Apache 2, MySQL 5, and PHP versions 4 and 5.
Lots of PHP extensions, which add extra functionality. In particular, the extensions required by Mambo are all in the XAMPP installation.
phpMyAdmin, the leading web-based interface to MySQL.
The PEAR library. PEAR (PHP Extension and Application Repository) is a framework for reusable PHP components, and is a favorite among professional PHP developers. You can find out more about PEAR at pear.php.net.
An implementation of OpenSSL for running your site under HTTPS.
The advantage of the XAMPP package is that everything you need is collected together for you, tested, and ready to go. The downside is that you will have a very large file to download. On the brighter side, you only have to download one file rather than downloading lots of files, and then trying to get them working.
The home of the XAMPP package is the site www.apachefriends.org/en/. The installation walkthrough in this chapter may not solve all your problems, and only covers Windows. If you find yourself in need of further help, check out the XAMPP documentation page at:
http://www.apachefriends.org/en/faq-xampp.html
Details of the XAMPP package itself can be found at:
http://www.apachefriends.org/en/xampp.html
On that page, you will find a link to the XAMPP version for your particular operating system. We will be choosing XAMPP for Windows. Clicking the XAMPP for Windows link on this page brings you to:
http://www.apachefriends.org/en/xampp-windows.html
You will find that there are several options for downloading XAMPP. First, you can choose one of three types of package:
XAMPP
XAMPP add-ons
XAMPP Lite
Each of these packages is available in different download formats, a Windows installer file, a ZIP file, or a self-extracting 7-ZIP archive:
We will be choosing the Installer version of the Basic XAMPP package. This is some 33MB to download.
There is also a XAMPP Lite package that is about half the size of the full XAMPP package, but it does contain everything that you will need to run the code in this book. However, the Lite package does not come as a Windows installer.
Clicking the Installer link takes you to a page where you select the 'nearest' SourceForge mirror site from which to download the file. You can download the file from any of the sites listed, so you might want to pick the one nearest to you. The downloaded file will have a filename of the form:
xampp-win32-1.5.5-installer.exe
The 1.5.5
part is the current XAMPP version.
We will install the XAMP package into a folder called c:\apachefriends\
. Before we begin, create that folder.
We begin by double-clicking on the file, and we will be presented with a dropdown to choose the language of our installation. Select English and click OK to move on to the welcome page, which displays a simple message, and you can click Next to move to the start of the process.
You will be presented with a dialog asking you to choose the location for XAMPP to install its files into. XAMPP will create a folder called xampp
in the Destination Folder specified, and add its files in there. Clicking the Browse button allows you to choose our apachefriends
folder.
Click Next, which will allow you to choose XAMPP install options:
In the SERVICE SECTION choose the Install Apache as service and Install MySQL as service options. You can keep the the last option to install Filezilla as a service unchecked since we don't have any need to run an FTP server in this book.
Note
If you are running the IIS server or Skype VOIP application, then exit them before attempting to install Apache as a Windows Service. Otherwise, the Apache service will fail to install as a Windows Service, with XAMPP reporting a problem with port 443 (for Skype) or port 80 (for IIS).
Click Install to continue and the installation begins. The files are extracted and copied to the specified folder. A command-line window will open at one point, right before the end; do not be disturbed by that. After the command-line window closes, the installation is complete, and you are presented with the end screen. Click Finish to complete the installation.
After this, you are presented with a congratulatory message, and an option to view the Control Panel:
The XAMPP Control Panel is used to control and monitor the status of the services that XAMPP has installed. When the Control Panel is running, you will see an icon like:
in your System Tray, and you can double-click it to get the XAMPP Control Panel back on your screen. If you have closed the Control Panel, you can open it again from Start | Programs | apachefriends | XAMPP | XAMPP Control Panel. Alternatively, you can control and monitor these services in the usual way from the Windows Control Panel (Start | Settings | Control Panel) by using the Services area found in Administrative Tools.
With our servers installed as services, we are ready to go. Open up your browser, and enter http://localhost/ into the navigation bar. You should see the following splash screen, inviting you to select a language. We will select English:
Now you will be taken to your XAMPP homepage. In future you will be taken directly to this page when you enter http://localhost/ into your browser, bypassing the language splash screen.
You will find a range of options in the left-hand panel for you to test out what comes with XAMPP. Of particular interest is phpMyAdmin, which we will be making use of in many parts of the book, and which is likely to become a very important tool as you work more with PHP and MySQL. You can click the link in the left-hand panel, or enter its URL (http://localhost/phpMyAdmin/) directly into the browser to get started with it.
By default, XAMPP is configured to run PHP 5. If you want to switch to PHP 4, then you will find a file called php-switch.bat
in the apachefriends\xampp\
folder that allows you to make the switch between PHP 5 and PHP 4 (and back again). However, before you can use it you need to stop the Apache Service.
Open up the XAMPP Control Panel, and click the Stop button next to the Apache service. You should see a message reporting the service has been stopped:
Now double-click the file php-switch.bat
in the apachefriends\xampp
folder, and a command‑line window will open, and you will be prompted to choose the version of PHP.
Simply press 4 followed by Enter, and XAMPP will switch over to PHP 4 for you. Once it has completed, you will see a message containing this report:
OKAY ... PHP SWITCHING WAS SUCCESSFUL
Press any key to close the window. You will now have to restart Apache from the Control Panel by clicking the Start button, and then you can return to your browser and visit your XAMPP home page. Once you are finished with the Control Panel, click Exit to shut it down.
You can use php-switch.bat
to switch back to PHP 5 again if you want to continue working with PHP 5, but remember to stop the Apache service before using it.
Before we finish off, it's worth noting two important folders in your XAMPP installation.
C:\Program Files\apachefriends\xampp\htdocs:
This folder is your 'document root'. A file placed in this folder will be made available by the web server. We will be copying our installation of Mambo into this folder to get it working properly.apache:
This folder contains a file calledapache_installservice.bat
. If Apache failed to install as a service during the installation process, then you can run this file to try again.
Your XAMPP installation is now set up and working, and you are ready to begin installing Mambo.