OK thanks - that was very helpful.
The instructions you reference require wget which didn't seem to be available to me in the command line, which is why I used the instructions I did.
Running through the various tests I got that pear's include path should be /usr/lib/php/pear, but phpinfo() was telling me the include path was .:
The line in php.ini for include path was commented out, with the value ".:/php/includes". I changed this to "/usr/lib/php/pear" - should I have left the ".:" before the first slash? Don't want to mess up anything that was working before.
phpinfo now shows the include path as /usr/lib/php/pear of course.
The test now works as it appears does my script. But worried I might have broken things (not yet discovered) by removing ".:" from the old path.