In this section, I will help you get your workstation set up so that you can follow along with the code in this book. You can read the code all day long, but to truly understand and grasp what the code is doing, it is best to read the code, and then type it and see how it executes.
To get our development environment going, we will be installing Aptana Studio 3 for our IDE and XAMPP for our web server environment. Both of these packages exist for Windows, Mac, and Linux, so no matter what your OS of choice is, you will be able to follow along. Also, they both are free.
First, we will install XAMPP.
XAMPP is a full-blown web server package. It includes Apache, PHP, MySQL, Tomcat, Perl, phpMyAdmin, and more.
The first thing we need to do is download XAMPP. You can find the installation file for your operating system at http://www.apachefriends.org/en/xampp.html. I recommend using the installer for Windows, instead of using the Zip file method.
This installation is pretty straightforward.
For Windows, follow these steps:
Double-click on the installation, and you will be asked to select a language. Make your choice and then click on OK.
If you are using Windows Vista or Windows 7, and User Account Control or UAC is enabled, you will be presented with a warning that some of the functionality may be limited if you install XAMPP to the Program Files
directory. Click on OK.
Another warning may pop up stating that you need to install the Microsoft Visual C++ 2008 redistributable package. Clicking on Yes will open a web page on the Microsoft Download Center, where you can download this package. Do so and then continue the XAMPP installation.
Click on Next, and then you can decide which features you want installed with your installation. For now, just leave the defaults as is and click on Next.
The default directory should be fine, so leave it as is and click on Install.
The installation itself will take several minutes; once it is finished, click on Finish on the screen that pops up.
You will then be presented with a screen that will inform you that all the services can controlled through a XAMPP Control Panel. It will ask you if you want to open that screen now, and then click on Yes.
On the Control Panel screen, you will be able to start and stop all the services that XAMPP installed. By default, these services may be off, so for now, let's turn on Apache by clicking on the Start button next to it.
For installation on Mac OS, simply download the .DMG
file, open it up, and drag the folder into the Applications
directory. After this, open up the XAMPP Control Panel (from the Applications
folder of XAMPP) and start Apache, MySQL, and ProFTPD. You may have to do this each time you restart your Mac.
To verify that everything was installed correctly and is working, open up your web browser and go to http://localhost
. You should see a screen similar to the following screenshot:
Congratulations, you now have a fully functional web server installed with PHP support! If you do not see this screen, make sure you've started the Apache service and followed all the installation steps correctly.
Now, we will install Aptana Studio.
Aptana Studio 3 can be downloaded from http://www.aptana.com/products/studio3/download. Currently, there exists Aptana Studio 2 and 3. We will be using Aptana Studio 3 for this book, so be sure that is the one you download.
For Windows, follow these steps:
Double-click on the installer file, and select Next to get the installation started.
Choose I Agree to accept the license agreement.
The default directory should be fine, as should the default programs group, so hit Next on these two screens.
The installer will now prompt you to choose what file extensions Aptana should be the default editor for. Leave the default settings on here. You can change it later in the IDE if you wish to. Click on Next.
Click on Install to start the installation. Once the installation is finished, click on Next and then on Close.
For Mac users, again download the .DMG
file, open it, then drag it into the Applications
folder.
After you have it installed, go ahead and open it. The first thing you will be presented with is a screen asking you to set up your default workspace directory. Go ahead and set this to the htdocs
folder of your XAMPP installation. For Windows users, this is c:\xampp\htdocs
(provided you kept the default directory) and for Mac is /Applications/XAMPP/htdocs
. This way, by default, all of our projects are in the Apache web server documents directory and can be easily tested without having to move files back and forth.
That's it. You are now ready to learn RESS!
There are several other PHP IDEs out there, such as Zend Studio, PHP Storm, and a host of others. If you already use Eclipse for other purposes, Aptana Studio can be downloaded as an Eclipse plugin (requires Eclipse 3.5 or higher). For the purposes of this book, we will be using the stand-alone version of the software.
A very important note about XAMPP is that while it appears, it would be easy to use to set up a full-blown web server; it is not recommended from a security standpoint to use XAMPP in a production server environment. It should only be used for development and testing purposes.
XAMPP for Mac is still listed as being in beta. Please take that into consideration before installing it on your system. Other MAMP solutions exist, and those would serve the same purpose of XAMPP for this book. One that is highly recommended is conveniently known as MAMP and can be found at http://www.mamp.info/en/index.html.
Also, a note about the htdocs
folder of XAMPP is that, by default, it is owned by root, and therefore, it is read-only. If you encounter an error while starting Aptana, you may need to change permissions on this folder. To do so:
Click on the folder in Finder and then choose the Get Info from the File menu.
Click on the triangle next to Sharing & Permissions to display permissions for the selected file or folder.
Click on the lock and authenticate with an administrator account.
Use the menus next to users and groups to change the permissions.
When you're finished, close the Info window.
For support on installing either of these software packages, please see their respective websites.