Debugging PHP, with breakpoints!

One thing that I have always disliked about PHP development was the seemingly difficult debugging process that came along with it.  The fact that you would save a file, and then have to open it in the browser to see what’s going on – sometimes to random results.  There was none of the usual ability to step through the code and create checkpoints – something that Java, .Net, and even JavaScript (since the web inspector came about) have had for a while.

Well it turns out that I was wrong. The ability to do this stuff exists, I was just unaware of it, and because of my willingness to accept the status quo, I never bothered to look for a way.

The missing piece of the puzzle is actually something that I have been using for a while. Xdebug. I have been using it to generate grind files, which allow you to profile your script using tools like WebGrind.

Add the following in your php.ini.

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

Then, in NetBeans, go to your options window and select the PHP tab.  Make sure that the Debugger Port corresponds to the one that you have set in your ini file.

Finally, restart your web server and have fun using breakpoints.

There is also a really useful guide from NetBeans on how to debug PHP using the inbuilt tools available to you.

Post from twitter to a facebook page

Recently I have been improving my parents website over at Yeldon Wedding Hire.  One of the things that I have been doing is setting up a social media campaign by setting them up a facebook page, a Google+ page, and a twitter feed.  To make the different social channels look like they are being used and updated I wanted them to cross-post items so that when I posted on twitter it posted to facebook, and vice versa.

Continue reading Post from twitter to a facebook page

Who needs iCloud?

There have been a lot of people talking about how great the new Apple iCloud is going to be, and whilst I agree that it will be useful, it is nothing new. Also, if you have an older phone (like me) you wont be able to benefit from it as apple are no longer getting iOS updates.

I use Google Apps which provides me with the mail, contacts and calendar syncing. I have to say it is an excellent service considering its free. Once you have activated mobile support in the Google Apps admin, its a simple configuration exercise to get everything synced over the air.

Connect your phone to Google using exchange as the protocol. You can get more info on how to do this by going to http://m.google.com/. When you have entered your details, select what you want to sync out of Mail, Calendar and Contacts. (I sync all three)

You now have your phone set up (and backing up contacts) to the cloud. Now to get those contacts into your mac. Simples. Go to address book preferences, and select accounts.

Apple Address book and Google

Tick the box next to Synchronize with Google and click on the configure button.

 

Thats it. You can then head on over to iCal to get your calendar synchronised too.