Monday, March 3, 2008

PHP Development Environment

Let me first start by saying that I have only started using PHP because I have to maintain a project that was written in PHP, so my experience is quite limited. However, I figure many others may be in the same situation. At the very least I wanted to note all the things I had to do to get my project to work. There are some very basic things I expect when doing development. 1. An IDE 2. A debugger that is integrated into the IDE 3. Stability in the IDE and debugger. This was not as easy as I thought it would be. However, after reading some blogs, etc, I determined there is at least one free option that actually work pretty well. Please read my comments below to better understand why I chose the tools I chose. The IDE is most important to me. Beyond the requirements above, I need it to be free because the project I am working on doesn't have a budget to buy us a pricey IDE. The IDE I like is PHP Development Tools (PDT), which is basically an Eclipse plug-in that allows you to do PHP development (including debugging) in the Eclipse IDE. Eclipse is a stable IDE with lots of features and is the same as what I use for Java development so the learning curve is smaller. I also tried Maguma Studio IDE and found it to be EXTREMELY frustrating. My scroll wheel crashes the IDE every time I touch it, and I do that a lot without even thinking about it. It also didn't seem to support virtual directories, so my projects had to be in my web root, which was not what I like to do. The debugger required regularly changing my php.ini if I remember correctly, which was more work than I felt I should have to do. If you those things don't bother you, you may like this product. There are a couple of debuggers out there, but I recommend the Zend debugger as it seems to work well with complex projects that have nested directories of source code. It Debuggers for PHP come in different flavors and are compatible with different products and different versions of products. I found this VERY confusing and a hassle to get my IDE and debugger working together. For this reason, I STRONGLY recommend that you use an all in one download / installation. This more or less guarantees the IDE and debugger will work together and with any luck even be pre-configured which can save you time. I believe the debugger choices are:
1. Zend Debugger
2. XDebug 3. DBG
I have not personally used anything except Zend Debugger, but my co-worker has, and he had trouble with nested directories and just generally getting it to work.
I like the Zend Debugger for several reasons.
1. I can download an all-in-one that includes the Zend and XDebug debuggers) and it fast to download (the site is fast)
2. It is comes pre-configured
3. It seems to work on nested directory structure
4. Seems stable
5. It works with the latest version (3.3.1.1) of Eclipse IDE
6. Use the newest PDT 1.0.2 (R2008010)
OK, now that you understand a little more of what I chose and why, here are the links to the downloads.
All-in-one download that includes Zend and XDebug debuggers, Eclipse IDE 3.3.1.1, PDT 1.0.2 (R20080103) http://downloads.zend.com/pdt/all-in-one/dt-1.0.2.R20080103_debugger-5.2.12.v20071210-all-in-one-win32.zip
If you don't want / need the Zend debugger I have heard good things about the PDT all by itself, but the site is much slower, and you won't get the Zend debugger, but it is the best place to get the latest PDT (I think) http://download.eclipse.org/tools/pdt/downloads/release.php?release=R20080103
You will also need the Java Runtime (JRE 5) to run the IDE. The JDK should also work if you already have it installed. http://java.sun.com/javase/downloads/index_jdk5.jsp
PHP (I don't actually recommend you install PHP separately since PDT comes with it. There are some things you will want to do if you want to run your project without the IDE on your machine. See http://www.nusphere.com/kb/phpmanual/install.windows.iis.htm).
A few tips: You will want to set the .php extension to point to something like: "C:\Program Files\pdt-1.0.2.R20080103_debugger-5.2.12.v20071210-all-in-one-win32\eclipse\plugins\org.zend.php.debug.debugger.win32.x86_5.2.12.v20071210\resources\php5\php-cgi.exe" You can do this at the Default Web Site level. However, in IIS those changes are COPIED when you create a virtual directory to your project (assuming you use a virtual directory and not just put your project in the web root itself). This means that If you set the .php extension BEFORE you create the virtual directory it will COPY that extension to the virtual directory extensions. However, if you set the .php extension AFTER you create the virtual directory, you will need to also put it in the extensions for that virtual directory.

1 comment:

Sji Infotech Pvt Ltd. said...

Thanks for this valuable post. Its really a helpful and effective post. I appreciate this kind of information.
Seo Company In India | Joomla Solutions