You are now on my Technical Blog. My other sites: Personal Blog - Genealogy Blog - Genealogy Site

DLMax Max Westen's ramblings on OSX and PHP

Blog Category: work

Developing in PHP with NetBeans 6.8

Nov 25, 2009

The problem:

I love Textmate as an editor period.

There are some things though that I started missing while developing:

  • Code completion
  • Inline documentation
  • instant error checking
  • debugging from my editor
  • must have strong syntax highlighting support for dark themes like my favourite Sunburst

So I started looking around for an IDE(or Editor) that would work for me and that I could adhere to.

The contestants:


I’ve heard a lot on VIM and really like the application. When you add a couple of plugins like Project, PHP-Doc, DelimitMate, SnipMate and Sunburst you can accomplish most of these tasks. An added feature is that you can configure VIM to work the same on your remote systems too, so it virtually doesn’t matter if you’re on Mac, Windows or Linux or working trough an SSH connection; your editor functions and looks the same. Most features from my list can be accomplished in VIM, but I can’t get used to the shortcuts. There are a lot of them and all of them are new compared to windows/mac users. If you’re in a full-time development job I think it’s very difficult to learn the new way of working and still deliver on time. So for me VIM isn’t something that can be used out of the box.

Eclipse PDT:

Eclipse with PDT 2.1 is another IDE I hear a lot of good comments on. All of the things I want to see in an alternative editor/IDE is there, except for the strong Syntax highlighting and easy themeing. Colours can be changed, but have to be changed on a lot of different locations, making it hard to do consistently. The PDT plugin has some nice features, but the syntax highlighting could be much better. Eclipse with PDT isn’t my thing because of the lack of syntax highlighting features, the difficult themeing (especially to darker themes) and the high memory consumption.


Aptana Studio 2.0 is a good IDE (I’ve used it before) with a very nice PHP plugin, but changed to use the PDT eclipse plugin. There is a way to use the older PHP plugin, but because development on that plugin has ceased, I don’t recommend it. The PDT plugin with Aptana has lacks the same points as discussed above under "Eclipse PDT".

Zend Studio:

Zend Studio 7.1 basically is Eclipse with the PDT plugin and some added features; specifically focussed on "Zend Framework", "Zend Server" and "Zend Debugger". Zend Studio isn’t a fit for me, because the problems I have with the Eclipse PDT plugin are the features taken from this plugin. If these points would improve it would be a good choice for me. The price could be a turnoff though if a free IDE is available that can do most you need.

Komodo IDE:

Komodo IDE 5.2 is a stable IDE and has a smaller memory footprint then the eclipse based tools. It has support for a multitude of languages, VCS(=Version Control Systems). The support for PHP and debugging are good and this is one of the few IDEs that are quite easy to style in a dark background. There are only 2 downsides for me; the price and the syntax highlighting could be even better. The price isn’t that high for a business, but I found an alternative that fits me better.


Netbeans 6.8 (currently in beta) is like Komodo a stable IDE with smaller memory footprint. It fits my wish-list and I can adapt quite easily to the shortcuts and natural for me. It’s a full featured IDE with all the bells and whistles. Room for improvement would be: More VCS plugins (Git), support for the Zend Debugger, scriptable (regexp) like syntax highlighting support, to be able to add custom highlighting.

NetBeans Tips:

Font rendering in NetBeans on OSX:

I love the anti-aliasing done by TextMate to my coding fonts. If you want to achieve the same effect in NetBeans, you need to add 2 parameters to the application startup-file.

  1. Open the finder and go to the file.
  2. Press the right mouse-button (or ctrl+click) and select the option "Show Package Contents".
  3. In the new opened finder window, go to the following location: "Contents/Resources/NetBeans/etc/"
  4. Edit the file: "netbeans.conf"
  5. add the following to the end of the line starting with: "netbeans_default_options=" -J-Dsun.java2d.noddraw=true
  6. save the file and start NetBeans.

The font will be like you used to see in TextMate.

Preventing Java crashes on OSX 10.6:

Update: I’ve updated to the final 6.8 release now and it runs fine on Java 6, so this workaround is probably not needed….

If you are working on OSX Snow Leopard (10.6) and NetBeans crashes randomly, it’s worth a try to downgrade your Java from 6 to 5. This probably greatly improves stability for NetBeans and other Java applications running on OSX. To downgrade, I followed the steps outlined on the oneswarm wiki and put them up here too.

Get the java 5 that was included in 10.5 "leopard" and unpack

cd /tmp/
curl -o java.1.5.0-leopard.tar.gz
tar -xvzf java.1.5.0-leopard.tar.gz

Move it to your System java folder (password needed)

sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard

Tell OS X that java 5 actually is java 5

cd /System/Library/Frameworks/JavaVM.framework/Versions/
sudo rm 1.5.0
sudo ln -s 1.5.0-leopard 1.5.0
sudo rm 1.5
sudo ln -s 1.5.0 1.5

Open Java Preferences

open "/Applications/Utilities/Java"

Change the properties to use Java 5 32-bit by default:

Start NetBeans and you’re done !

Installing PHP 5.2.8 on OSX Leopard 10.5.6

Dec 29, 2008

Because I travel a lot by train, it’s easy to have a local development environment with me. Because OSX Leopard contains Apache2 and PHP 5.2.6, I installed MySQL, ZF, PEAR, setup the vhost conf for apache and added the path to the ZF and PEAR libraries to /etc/php.ini. This seemed to work fine for a day or two, but after that I needed to use the PDO_MySQL library. This didn’t really work… The fact is that PDO_SQLite and PDO_SQLite2 are compiled along the installed PHP library, but PDO_MySQL isn’t… Big FAIL!.

So, we’ll have to setup a new PHP/Apache2 combo…..

Okay let’s start:

1. Install the Apple Developer tools

If you haven’t done it already, install the Developer Tools(XCode 3) from the OSX DVD

2. Install and update MacPorts

If you haven’t installed MacPorts on your system, do so by downloading it from the MacPorts website and running the installer. Now open a terminal window and update MacPorts:

sudo port selfupdate
sudo port sync

3. Install apache2

Create the following directory and symlink for the correct use of MySQL (the install searches there for libraries):

sudo mkdir /usr/local/mysql/lib/mysql
sudo ln -sf /usr/local/mysql/lib/lib* /usr/local/mysql/lib/mysql/

Install Apache2:

sudo port install apache2

Let the apache2 process be autostarted by the system:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

Move the old Apache stuff out of the way:

sudo mv /usr/sbin/apachectl /usr/sbin/apachectl-leopard
sudo ln -s /opt/local/apache2/bin/apachectl /usr/local/bin/apachectl

Copy the sample conf file and make it the default

sudo cp /opt/local/apache2/conf/httpd.conf.sample /opt/local/apache2/conf/httpd.conf

Now you can modify your apache settings to your liking, but remember to use only the ones in the /opt/local/apache2/conf directory; the old configs(/etc/apache2/conf) are not used anymore.

4. Install the additional stuff needed

Then make sure we have everything installed we want in there; I want: GD libraries, iconv, PDO_MySQL, curl

sudo port install jpeg
sudo port install libpng
sudo port install freetype
sudo port install libmcrypt
sudo port install tidy
sudo port install libiconv

Rename the default iconv.h because it generates errors while compiling PHP

sudo mv /usr/include/iconv.h /usr/include/iconv.h.leo_orig
sudo ln -s /opt/local/include/iconv.h /usr/include/iconv.h

5. Download, configure and install PHP

Download the php5.2.8.tar.gz file from the PHP website. go to your download directory and run

tar xvzf php-5.2.8.tar.gz 

Then move this folder to the /opt/local/php-5.2.8 folder

sudo mv php-5.2.8 /opt/local/

Then create a symlink that you can compile against:

sudo ln -s /opt/local/php-5.2.8 /opt/local/php

Go into the newly created ‘folder’:

cd /opt/local/php/

Now configure PHP:

'./configure' \
'--prefix=/opt/local/php' \
'--with-apxs2=/opt/local/apache2/bin/apxs' \
'--with-xsl=/usr' \
'--with-tidy=/opt/local' \
'--with-ldap=/usr' \
'--with-kerberos=/usr' \
'--enable-mbregex' \
'--enable-ftp' \
'--with-iodbc=/usr' \
'--with-curl=/usr' \
'--enable-mbstring' \
'--with-gd' \
'--with-jpeg-dir=/opt/local' \
'--with-png-dir=/opt/local' \
'--with-zlib-dir' \
'--enable-sockets' \
'--enable-exif' \
'--with-mcrypt=/opt/local' \
'--enable-soap' \
'--with-mysql=/usr/local/mysql' \
'--with-mysqli=/usr/local/mysql/bin/mysql_config' \
'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config' \
'--with-mysql-sock=/tmp/mysql.sock' \
'--with-freetype-dir=/opt/local' \
'--with-openssl=/opt/local' \
'--with-iconv=/usr' \
'--with-libxml-dir=/usr' \
'--with-xmlrpc' \

Then make and install php:

sudo make
sudo make install

And rename the old PHP and create a symlink to the new binary:

sudo mv /usr/bin/php /usr/bin/php-leopard
sudo ln -s /opt/local/php/bin/php /usr/bin/php

copy the new php.ini file and edit it to your liking:

sudo cp php.ini-dist lib/php.ini

Note: The new php.ini file in use is the one located at: /opt/local/php/lib/php.ini

6. Restart the webserver

Up until now the old webserver was running. Shut it down and then start the new apache2:

sudo apachectl-leopard stop
sudo apachectl start

If all went well, Apache is running and PHP scripts get executed. Please check the installed features by calling a page with the following code on it, to ensure everything is installed.

In the next post we will add xDebug to the stack and later on the debugging environment is setup for different IDEs.

Part2: Installing xDebug on OSX

My Adobe MAX report

Dec 28, 2008

As told in my last post, I was invited to the Adobe MAX conference in San Francisco. I really had blast there. Thanks again for inviting me Mike! This blogpost only covers my personal experiences; to read more about the tracks I followed and what they were about, you’re more than welcome to read the report on my company-blog.

On Saturday morning I traveled to Amsterdam and took a flight to London. From London I then had a flight to San Francisco, where I arrived on Saturday evening. Ivo told me to take the BART instead of a cab for traveling down-town; this would only cost around five bucks instead of forty for a cab. When exiting the BART, I headed over to 3rd street (I thought), but I went the wrong way. After about 10 minutes of walking and looking at street-names I finally started Google Maps from my mobile phone to look up where I was and what directions to follow to my hotel. After walking 15 minutes the other way, I arrived at the Westin, checked in and went out to get some food. Around the corner was a DelTaco, where I had some tacos, before taking a bath and going to bed.

I left the curtains open, because of the great view of the city skyline by night, from the 33rd floor, so when I woke up the next morning, I was greeted with the following view: View from my bed

After setting up my wifi first, and later on fixed-ethernet because of the bad reception, I checked on my mail and did a web cam session with the kids. Then I went looking for something to eat. After wandering around for a couple of hours I saw a big line of waiting people in front of Mel’s drive-in. This either had to mean the food was for free ;) or it was good, so I queued up. The lunch (it was that late then) was very good and the coffee was terrible. Especially if you’re used to strong European coffee. Because I was around the corner of the Moscone Center, I decided to pre-register and pickup my badge and conference guide. As you can see there were only a handful of people there, so it only took 2 minutes. The registration desks

I had some time to spare, the dinner meeting was at six thirty, so I walked over to the Apple store to look at all nice toys at hand. After playing with the iPod Touch for a while, I bought one, and went back to the hotel to play with it, until it was time for dinner. We met in the lobby at six thirty and walked to restaurant Lulu, were we had a very nice dinner and conversation on who we were, what we do and what interests us, both work and private. I had some very nice talks with Zeke Koch, Adrian Ludwig, Paul Reinheimer and Larry Ullman.

Tuesday evening was reserved for the customer appreciation event, that was held in The Academy of Sciences and de Young Museum. At first Larry and I thought of skipping it, having a dinner together and then go to the hotel to get some sleep. On the way to the hotel we ran into Aaron Conran and we got into a nice conversation on the corner of 4th and mission street. After standing talking there for about an hour we decided to go with Aaron to the Customer Appreciation Event. We got on the bus around the corner of the Moscone Center, that took us to the de Young Museum. When we entered the museum, there were bars, buffets and musicians playing. We tried to get some food first, but there were only sweet desserts, so we attacked. Then we walked around and saw there were buffets with different food types scattered around. Eventually we had some very good food. It was very cool to be able to walk around in the evening, eating and drinking between old skulls and the Haute Couture from Yves Saint Laurent. Around 22:30 the museum closed and we were transported back to the Moscone Center. When we were in the bus, we passed another building, that spit out a lot of people too, we then realized that was the Academy of Sciences; we didn’t even get that far. Hearing all stories and seeing the pictures of the Academy of Sciences, I felt sorry that we didn’t pay a visit to that too. Entrance to Science AcademyRain ForestCool 3D Neon painting

Wednesday evening, after the last session on the "next version of Flex Builder", I went back to my hotel, just to walk into Larry again. I wanted to have a dinner and Larry could use a bite before taking his plane too, so we wandered a bit around the financial district, until we found a nice thai restaurant. We had some very good food there, before we walked back to the hotel. On our way back we had a nice coffee from Pete’s. Pitty it was only half a cup, because they were closing and it was the last they had ;) . Larry left to the airport and I packed up too. I had to leave the next day at one.

On my last day in SF I got up late, packed my stuff, and went down to check out. Thanks again Mike ! That was a nice surprise! I then went back to the Apple store to return my iPod Touch; I really enjoyed it, but hated the lack of internet if no public wifi was around, so I decided to get an iPhone instead! With that taken care of, I could use some food before having a trip that would take almost 25 hours, so I checked out the hotel restaurant. They had some expensive pasta, that turned out to be very small portion, but at least it tasted good. I took the BART back to SFO and left SF with a temperature of 15°C. When I arrived home it was 16°C colder… brrr

As told on my company blog: It was an awesome experience and I’ve learned a lot. I’ve learned lots of new stuff on AIR and FLEX and I’ve learned it’s wise to not over-plan your schedule, but leave some holes in which you can socialize and network or just write up some of the things you need to remember for blog-posts like this.

More pictures I took in SF: More pictures by Justin Korn:
Max08 Justin Korn Photography

I'll be attending Adobe MAX San Francisco

Nov 11, 2008

I will be attending THE Adobe event; Adobe MAX, that’s held on 17, 18 and 19 November in the Moscone center and the Marriot Yerba, San Francisco.

Adobe invited Ivo, but since he was already occupied and I was already developing in Flex and AIR, Ivo asked if I liked to go…. YEAH of course ! ;).

There’s a real cool session/lab selector, that you can use to schedule your days and afterwards export the schedule to a VCF file for importing in your calendar, or exporting to PDF for printing. Since they didn’t include an export to blogging software, I’ll have to enter that by hand.

My main focus will be Flex and AIR in relation to back-end development with PHP. I also want to have a look at the "Thermo" product, that will get a new name during MAX, because it’s one of the core concepts in bringing the developer and the designer together.

The schedule I most certainly will follow: Monday: 17 nov 2008 09:30-11:00 - Max 2008 Opening General Session 11:30-12:30 - Looking ahead to the next version of Flex 12:30-15:30 - Adobe meetup 15:30-16:30 - Introduction to Thermo and the next generation of Flex 17:00-18:00 - Hybrid Applications: Where javascript and Flash play together

Tuesday: 18 nov 2008 09:00-10:00 - Developer best practices with Flex 10:30-12:00 - General Session 13:30-17:00 - Adobe AIR Bootcamp 18:00-19:30 - Sneak Peeks

Wednesday: 19 nov 2008 09:30-10:30 - Working with data in Flex 11:00-12:30 - Using Flex and Adobe AIR to automate CS4 Workflows 14:00-15:00 - Flex in the city: A single developer diary 15:30-16:30 - Building web-to-print Applications using Flex, AIR and Indesign Server 17:00-18:00 - Looking ahead to the next version of Flex Builder

A lot going on...

Nov 11, 2008

Long time no writeups (at least none of them are finished posts). A lot has happened this last year:

  • We finally completed the garden… Yay !
  • We had a very nice holiday in France
  • The girls are growing like crazy and it’s hard to keep up with their development.
  • We think one of the girls has mild “Selective Mutism” and we’re now trying to stimulate her and her school in getting her trust back and letting go of her fear.
  • I switched to a new employer; the best PHP development firm in The Netherlands and the UK: Ibuildings. I’m working for the team in Sittard and work there two days a week and telecommute the other three. Having lunch with the kids is a real plus !

Watch this space… more updates will follow…