Jan 30 2009

How to profile your PHP scripts with Xdebug

Performance is a big issue on the web, if you pages take too long to load then people will go elsewhere. Sometimes your problems can be solved with cache control on your server, but still some cases require optimisation of your code. For this task, you should be using a technique known as ‘profiling’ – essentially a debug log of what your script or program did during execution, which functions were called and how long it took. It gives you a great glimpse into what it is that is taking too long to execute which means you have something concrete to look at when you need to optimise your system.

Fortunately Read the rest of this entry »

Geoff Adams
Programmer, Research and Development

Jan 29 2009

Creating Mobile Websites

mobile-web-development

Gone are the days when a separate version of a web site was required to see a web-site. Many 3G Phones, such as the iPhone and Android compatible phones  support rendering of web pages in their full glory (except for Flash on the iPhone). While this creates the richness that one expects when you are surfing at home on your laptop or desktop computer. It can still be difficult to navigate around a large web pages. If you really want to make your website usable on a mobile phone it might be a better idea to go for a mobile version of a website.  Domains are available for mobile websites and  it is a good idea to buy the .mobi domain for your mobile website to host your mobile version of your website to show you are really serious about providing mobile content.

Read the rest of this entry »

Sir Pumpkin Longshanks
Programmer, Research and Development

Jan 14 2009

Finding the Path to Root with PHP

linux-sign1

Occasionally, it is necessary to know the absolute path when preparing  a configuration file. Such as when editing the configuration file of an applications such as OSCommerce or installing Joomla. It can be very frustrating when the program won’t work because you don’t know the absolute path. Just opening your FTP editor and looking at the directory structure is not going to work. So how can you find the path? PHP has several commands which will reveal this to you. The function getcwd (get current working directory) will store the value:

<?php
  echo getcwd();
?>

Another way to acheive the same thing is with:

<?php
  echo realpath(dirname(__FILE__));
?>

Simply copy in one or the other programs into a blank file call it ’show_path.php’ and upload it to your web directory. Go to the page in your browser at the absolute path will be returned. Simple.

Sir Pumpkin Longshanks
Programmer, Research and Development

Jan 02 2009

PHP Development Tools v2.0

It has been a long time coming, but it is finally here: the PHP Development Tools for Eclipse (PDT) have reached v2.0! We mentioned a few weeks ago that the project was going into release candidate overdrive in the run-up to its proposed release on Dec 29th, well, it well and truly did that. It even made its predicted release date! That has to be an achievement in open source development!

So, what can you look forward to now? Well, a whole raft of new snazzy features, split between various parts of the system which makes up PDT (such as the Web development tools and dynamic languages core behind it all). As it now runs in Eclipse 3.4, you can utilise the brilliant new JavaScript editor, a much improved code assist feature and support for all the new little bits and pieces which are lurking around for the current Eclipse base.

It remains to be seen what the big killer features will be for this new version, but from what I have experienced of it so far, it seems a much more stable and solid base from which PDT can blossom for the future. This all means better features, more often – which is never a bad thing!

You can grab the all-in-one package here, so hop to it!

Geoff Adams
Programmer, Research and Development