Archive

Posts Tagged ‘wamp’

How to setup a complete PHP development environment on windows

January 8th, 2009

Why to use an IDE

Code Completion

When you start to type a variable name or reference an object the IDE will present options that would autocomplete what your typing. It also presents the documentation saying which each parameter of a method call is. This is easiest to explain by showing you a picture:

Netbeans - Code Completion

Netbeans - Code Completion

Easy browsing

As you can see in the image, I have one pane for browsing files, one pane for browsing methods. The central pane showing the code is coloured to tell you which words are variables, functions, constants etc. Notice also that you have multiple files open in tabs like firefox. So I can now browse easily through directories/methods and recently opened files. very Handy.

Netbeans PHP Support

Netbeans PHP Support

No more echo debug_var

Why waste time echo’ing some variables, XDEBUG allows you to select a line that your interested in, the program will then stop running at that point and you can step through the code line by line and watch as each variable changes to see where the problem is.

The Setup

Download and install Netbeans 6.5 for PHP

Take advantage of syntactic and semantic code highlighting, pop-up documentation, code formating and folding, instant rename, code templates, and automatic code completion (including bracket completion) for PHP. The Editor recognizes PHP code including heredoc notation in PHP projects and in PHTML and PHP files.

Download and install MySQL GUI Tools

Never type “Select * from …” again. With simple clicking you can create/edit/drop/select tables. Far easier and quicker. You might also want to check out mysql workbench on the same site.

mysql-gui-tools

mysql-gui-tools

OPTIONAL install Subversion

If only working indiviually the versioning provided internally by netbeans may be sufficient otherwise checkout installing subversion and tortoise SVN. This allows you to save your project at different points. Later if you find out something has broken, you can revert to any earlier date. But thats the simplest method it offers. You can look back at one particular file and see which lines changed on what date. In a team environment this is essential for seeing who changed what files.

Download and install WAMP

WampServer is a Windows web development environment. It allows you to create web applications with Apache, PHP and the MySQL database. It also comes with PHPMyAdmin and SQLiteManager to easily manage your databases.

Environment setting

At times we will need to call PHP or MySQL from the command line to do this we have to setup the PATH environment. Right-click on My Computer, than Properties. Switch to Advanced tab and click the Environment Variables button. At the end of variable PATH add “;C:\wamp\bin\php\php5.2.6;C:\wamp\bin\mysql\mysql5.0.45\bin” (note separated by a semicolon). These paths may be slightly different depending on your version, Have a browse.

XDebug

Download the .dll from XDebug website (last time I checked it was on right hand menu, under windows modules). Save the file “php_xdebug-2.0.3-5.1.7.dll” to the “C:\wamp\bin\php\php5.2.6\ext” folder. Or the similar folder on your install as your PHP version may be different. Browse to “C:\wamp\bin\apache\apache2.2.8\bin” and edit “php.ini”. At the bottom of the PHP.ini also add

zend_extension_ts=”C:/wamp/bin/php/php5.2.6/ext/php_xdebug-2.0.2-5.2.5.dll”
xdebug.remote_enable=1

Apache Rewrite

Apache URL Rewrite Module is needed to allow nicer looking URL’s, by default its off in WAMP. We need to turn it on - left click on WAMP’s tray icon , then in Apache >> Apache Modules menu select rewrite_module.

php_xsl extension

Again left click on WAMP’s tray icon. Then PHP >> PHP Extension menu, look for php_xsl and click it. But there is one more php.ini file, which WAMP won’t change (no clue why) - we need to do it by hand, let’s open: C:\wamp\bin\php\php5.2.5\php.ini and remove “;” from the line “;extension=php_xsl.dll”. This uncomments it. At the bottom of the PHP.ini also add

zend_extension_ts=”C:/wamp/bin/php/php5.2.6/ext/php_xdebug-2.0.2-5.2.5.dll”
xdebug.remote_enable=1

Restart WAMP

Again left click on WAMP’s tray icon then select restart all services. Note: mySQL default username:”root” password:”" , thats right BLANK. All documents for the webserver are now located in c:\wamp\www\

web development , , ,