For one other person it was a chroot issue, but if I set Restrained to No in this virtualhost it makes no difference. Another person had to yum install php5-cli but that is not a recognised package on my CentOS server.
Maybe I need to recompile PHP with --enable-cli ?
Or how else can I tell PEAR where PHP is and vice versa? I know I can add include paths to PHP.ini or compile with the paths but where is PEAR? Can I hardcode the PHP path in that PHP code?
OK to answer my own question, the php.ini is not the binary as I suspected. It should have /opt/lsws/fcgi-bin/lsphp-5.2.13 as the binary path instead.
Then pear no longer chokes, but it does still have problems:
Running initial setup...
php -[b|c|h|i|q|s|v|?] [<file>] [args...]
Run in LSAPI mode, only '-b', '-s' and '-c' are effective
Run in Command Line Interpreter mode when parameters are specified
-b <addressort>|<port> Bind Path for external LSAPI Server mode
-c <path>|<file> Look for php.ini file in this directory
-h This help
-i PHP information
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-? This help
args... Arguments passed to script.
Key line appears to be "Run in Command Line Interpreter mode when parameters are specified" which perhaps brings us back to compiling PHP with --php5-cli, do you think so?
OK this works, so if ever someone or myself needs this again:
In Magento install root:
cp pear pear2
Now open pear2 with vi/vim and find this part around line 63:
# find which PHP binary to use if test "x$MAGE_PEAR_PHP_BIN" != "x"; then PHP="$MAGE_PEAR_PHP_BIN" else PHP=php fi
And replace with LSWS's stock method of setting the PHP binary:
# find which PHP binary to use if test "x$PHP_PEAR_PHP_BIN" != "x"; then PHP="$PHP_PEAR_PHP_BIN" else if test "/opt/lsws/lsphp5/bin/php" = '@'php_bin'@'; then PHP=php else PHP="/opt/lsws/lsphp5/bin/php" fi fi
Now pear works as CLI, with all the PHP arguments allowed, and the proper Mage reference directories. Run: