Php – Can’t seem to set the php.exe path in pear.bat

pearPHPxampp

I installed PEAR and when I try to run it, I receive this message:

PHP_PEAR_PHP_BIN is not set correctly. Please fix it using your
environment variable or modify the default value in pear.bat The
current value is: .\php.exe

In the pear.bat file that error message is generated as such:

:PEAR_PHPBIN_ERROR
ECHO PHP_PEAR_PHP_BIN is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_PHP_BIN%
GOTO END

At the top of the file there is a conditional set like so:

IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=.\php.exe"

That's my starting point. I've changed that path to this:

IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\hqp\xampp\php\php.exe"

Regardless of the change, I get the same error in the command line, as in it still thinks the value is .\php.exe. I can tweak the error message and my tweaks will appear in the command line so I'm confident this pear.bat file is being referenced.

So my assumption is, based on that condition, "%PHP_PEAR_PHP_BIN%"!="" and if that is the case, where is it being set so I can override it to my correct path? Ideas where I should look or how to troubleshoot this further?

Here's my pear.bat source code: http://codetidy.com/919/
Thanks!

Best Answer

I was able to override the path by removing the condition:

Replaced

IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\hqp\xampp\php\php.exe"

with

SET "PHP_PEAR_PHP_BIN=C:\hqp\xampp\php\php.exe"

Though this solved my issue, I'd still like to know where that value was being set prior to this file. I confirmed the path was correct in the php_bin value in the pear.ini file as well, of course.

Related Topic