[Resolved] PEAR PHP Path Error

Status
Not open for further replies.

J.T.

Well-Known Member
#1
Hi,

I'm trying to update Magento with PEAR but it complains of not being able to find PHP.

I built PHP 5.2.13 with:

'./configure' '--prefix=/opt/lsws/lsphpmage' '--with-libdir=lib64' '--with-kerberos' '--with-mysql-sock=/tmp/mysql.sock' '--with-gd' '--enable-shmop' '--enable-track-vars' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-magic-quotes' '--enable-mbstring' '--with-iconv' '--with-mhash' '--with-mcrypt' '--with-mysql' '--with-pear' '--with-xml' '--with-simplexml' '--with-zlib' '--with-enable-inline-optimization' '--disable-debug' '--with-dom' '--with-dom-xslt' '--with-sqlite' '--with-curl' '--with-php-soap' '--with-soap' '--enable-soap' '--enable-pdo' '--with-mysql-pdo' '--with-pdo-mysql' '--with-gif' '--with-jpeg' '--with-png' '--enable-jpg' '--enable-png' '--enable-gif' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-litespeed' '--with-openssl' '--enable-ftp' '--enable-calendar' '--enable-json' '--enable-gd-native-ttf' '--with-freetype' '--with-freetype-dir=/usr/include/freetype2' '--with-ttf' '--enable-suhosin'
So --with-pear is there.

But I get this error:

[qoute]
# ./pear mage-setup

Error:

./pear: line 91: exec: php: not found
[/quote]

Line 91 is:

PHP:
exec $PHP -C -q $INCARG -d output_buffering=1 -d variables_order=EGPCS \
    -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" \
    -d auto_prepend_file="" -d auto_append_file="" \
    $INCDIR/pearmage.php -c $PEAR_INI "$@"
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?
 
Last edited by a moderator:

NiteWave

Administrator
#2
if have compiled lsphp5 from lsws admin console, default location of command line php is at /usr/local/lsws/lsphp5/bin/php
Can I hardcode the PHP path in that PHP code?
can you try it? or copy /usr/local/lsws/lsphp5/bin/php to /usr/bin or /usr/local/bin if no php there before ?
 
Last edited by a moderator:

J.T.

Well-Known Member
#3
I'm an idiot, at the top of the file it had comments to set the PHP binary path.

PHP:
# REPLACE with your PHP5 binary path (example: /usr/local/php5/bin/php )
Does it want the .ini or do they mean something else with PHP5 Binary?

When I enter the path and php.ini there I get a new error:

./pear: line 91: /opt/lsws/lsphpmage/lib/php.ini: Permission denied
./pear: line 91: exec: /opt/lsws/lsphpmage/lib/php.ini: cannot execute: Permission denied
In this VHost Restrained is No. I'm running the pear command as root. Any ideas?

ExtApp Set UID Mode DocRoot UID
ExtApp Chroot Mode Same as Server
ExtApp Chroot Path Not Set
 
Last edited by a moderator:

J.T.

Well-Known Member
#4
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:

./pear mage-setup
Running initial setup...
Usage: php
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 <address:port>|<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.
Getting closer...

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?
 
Last edited by a moderator:

NiteWave

Administrator
#5
there is a "pear" -- /usr/local/lsws/lsphp5/bin/pear for default installation(to /usr/local/lsws), so maybe should use this "pear"?
 
Last edited by a moderator:

J.T.

Well-Known Member
#6
# /opt/lsws/lsphp5/bin/pear -i

That works, so that runs as CLI.

But this does not work:

# /opt/lsws/lsphp5/bin/pear mage-setup
Command 'mage-setup' is not valid, try 'pear help'
Seems like I will need to merge those files to get the best of both.
 
Last edited by a moderator:

J.T.

Well-Known Member
#7
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:

PHP:
# 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:

PHP:
# 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:

./pear2 mage-setup and it will work from there...

# ./pear2 mage-setup
Running initial setup...
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
config-set succeeded
Channel "connect.magentocommerce.com/core" is already initialized
Channel "connect.magentocommerce.com/community" is already initialized
Next, run

./pear2 list-upgrades

To see what is available to upgrade.
 
Last edited by a moderator:
Status
Not open for further replies.
Top