Can't seem to set my php.exe path in pear.bat
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/9开发者_JAVA技巧19/ Thanks!
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.
For Windows, must SET "PHP_PEAR_PHP_BIN" under user environment variable to path to php.exe. Like me, I set it to "C:\wamp\bin\php\php5.3.0\php.exe". This will solve your problem.
For wamp on windows set environment variable as
Go to System>Advanced System Settings.
Then set environment variables as
PHP_PEAR_PHP_BIN
c:\wamp\bin\php\php5.3.13\php.exe
Save Run cmd and type pear on command prompt.
you shall find it in user variables under environment variables in windows. I was facing the same issue, then changed the value for user variables and it worked.
continuing on in the installation the document at http://pear.php.net/manual/en/installation.checking.php under verify include paths states to run php --ini at the command line. doing this i noticed that Configuration File (php.ini) Path: was set to c:\windows (this is a widows xp machine) I thought this was strange so i went looking for the file to see what was in it. There was no php.ini file but there was a pear.ini file so i decided to look at that. It has to lines in it, the second like is where i found the path. The file read s:7:"php_bin";s:9:".\php.exe" near the end of the line i changed it to s:7:"php_bin";s:9:"C:\php\php.exe" and all was good.
Just thought i would update this as i dont like to change batch files that should not need to be changed.
change the ./php.exe to the actual path eg c:xampp\php\php. thanks
A simple solution without going withing the environment variable of Windows.
You can edit the PEAR_ENV.reg file available after first installation of Pear. This file should be in your PHP folder. Within this file you will find the following line:
"PHP_PEAR_PHP_BIN"=".\\php.exe"
to
"PHP_PEAR_PHP_BIN"="F:\\PHP5.2\\php.exe"
Change "F:\PHP5.2" to whatever where is you PHP installation. You can now double-click on the PEAR_ENV.reg file to setup correctly your environment variable.
精彩评论