[solved] PEAR PHP Path Error

Discussion in 'PHP' started by J.T., Jun 9, 2013.

  1. J.T.

    J.T. Well-Known Member


    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:

    So --with-pear is there.

    But I get this error:

    # ./pear mage-setup


    ./pear: line 91: exec: php: not found

    Line 91 is:

    exec $PHP --q $INCARG -d output_buffering=-d variables_order=EGPCS \
    d open_basedir="" -d safe_mode=-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: Jun 9, 2013
  2. NiteWave

    NiteWave Administrator

    if have compiled lsphp5 from lsws admin console, default location of command line php is at /usr/local/lsws/lsphp5/bin/php
    can you try it? or copy /usr/local/lsws/lsphp5/bin/php to /usr/bin or /usr/local/bin if no php there before ?
  3. J.T.

    J.T. Well-Known Member

    I'm an idiot, at the top of the file it had comments to set the PHP binary path.

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

    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: Jun 9, 2013
  4. J.T.

    J.T. Well-Known Member

    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:

    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?
  5. NiteWave

    NiteWave Administrator

    there is a "pear" -- /usr/local/lsws/lsphp5/bin/pear for default installation(to /usr/local/lsws), so maybe should use this "pear"?
  6. J.T.

    J.T. Well-Known Member

    # /opt/lsws/lsphp5/bin/pear -i

    That works, so that runs as CLI.

    But this does not work:

    Seems like I will need to merge those files to get the best of both.
  7. J.T.

    J.T. Well-Known Member

    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
    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
    test "/opt/lsws/lsphp5/bin/php" '@'php_bin'@'then
    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...

    Next, run

    ./pear2 list-upgrades

    To see what is available to upgrade.
    Last edited: Jun 9, 2013
  8. NiteWave

    NiteWave Administrator

    Thanks. looks like an complete guide.

Share This Page