How to Set Up a Webdev Environment

From ISoft Wiki
Revision as of 11:18, 16 June 2011 by Aserafino (talk | contribs)
Jump to navigationJump to search

Setting up Your Local Webserver

Before you can do local development on Web products, you need a web server that supports PHP 5.3. The standard here at ISoft is Apache 2.2.17 in conjunction with PHP 5.3.5, and a MySQL connector or server of some kind. In the future, we will theoretically support IIS, since some clients use it on their Windows boxes, but this Wiki currently only covers the WAMP stack.

Installing WampServer 2

The easiest way to get all of this up and running from a clean install is with WampServer2, which can be downloaded and installed here.

If you've already got some installed components, you'll have to install some things separately, but none of the individual components should be too difficult to get working.

Installing the xdebug Plugin for PHP

This plugin is needed in order to step through your PHP scripts in the IDE of your choice (read: Eclipse). You can find step-by-step instructions for properly downloading and installing the xdebug plugin here. This wizard tailors its instructions to your particular setup.

Setting Up Eclipse

The Foundation: Eclipse, Classic Edition

We're going to be starting from the Classic Edition of Eclipse, which can be found at the Eclipse project homepage. Alternately, you can grab Eclipse for PHP Developers, but if you get that version, and you want Java or other languages, you'll have to add them yourself later.

Installing Eclipse

Eclipse doesn't "install" per se... Instead, it unzips into its own folder on your local hard drive. I unzipped mine into C:\Program File\eclipse. You will have to create any Start Menu or Quick Launch shortcuts yourself, but eclipse is ready to go out-of-the-box. All you have to do when you run it for the first time is specify a workspace folder, and the default is usually fine.

Standard Eclipse Plugins

You will also need some specific tools to do development in PHP, Javascript, CSS, and HTML.

To install plugins, click Eclipse's 'Help' menu and choose "Install New Software." In the dialog that appears, choose "Helios" from the "Work with" dropdown. In the list of updates, expand the Programming Language item and check off Java, XML, Javascript, and PHP. From "Web, XML, and Java EE Development, choose Java EE, XSL, and Eclipse Web Developer tools. Also grab the Web Page Editor. Click through the install wizard and restart Eclipse if required.

Optional Plugins

Subversion Integration

The Subclipse plugin is a powerful tool that integrates subversion with Eclipse. This plugin is optional considering some developers may already be comfortable with Tortoise SVN; however, if you want to integrate subversion into your IDE, subclipse is a very slick way to do it.

To install Subclipse, go back to Help->Install New Software. In the Work with box, enter "http://subclipse.tigris.org/update_1.6.x" and click Add. Give the repository a name like "Subclipse repository," click OK and wait for the update list to refresh. From the update list, check off the boxes for Core SVNKit Library and Optional JNA Library. From the Subclipse submenu, choose all of the required items. Click through the installer.

Restart Eclipse if necessary, and you should now be ready to work with SVN from inside the IDE.

Installing Quantum DB

Quantum DB is also optional, since you might already be used to SQLYog; however, if you'd like to browse and manipulate databases from within your IDE, it's a powerful, competitive tool. The update site for Quantum DB (which can be added in similar fashion to the update site for Subclipse above) is http://quantum.sourceforge.net/update-site. Select all Core and Import-Export packages, then click through the installer.

Connecting to a Database

To connect to a database, you will need MySQL Connector/J, which can be downloaded from http://dev.mysql.com/downloads/connector/j/. Once you have the jar file somewhere on your hard drive, go to the Quantum DB perspective (Window->Open Perspective->Other->Quantum DB), right click inside the Database Bookmarks view and choose "New Bookmark..." Click the "Add driver" button, click the "External JAR file" button, browse to the Connector/J .jar file. Click browse to choose a driver object and choose the top one (com.mysql.jdbc.Driver). Click OK.

Back in the New Bookmark dialog, choose MySQL-AB JDBC Driver, click Next, and fill in the database details. Click Next, choose a name for the database, and you're almost done. The final step is to change a single setting on the database bookmark that will fix a compatibility issue between MySQL Connector/J and the way our databases are formatted.

Right click the new bookmark and choose Properties. At the end of the Connection URL, paste the string "?zeroDateTimeBehavior=convertToNull" and click OK. You should now be ready to connect to your database by double-clicking the bookmark, and you can browse and run queries in much the same way as you could in SQLYog. Take some time to experiment with the new interface.

[[Category: ]]