Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.15

Bug #17081 pear.bat won't run from other directory
Submitted: 2010-02-09 09:18 UTC
From: dmagick Assigned: dufuz
Status: Assigned Package: PEAR (version Unknown)
PHP Version: 5.3.1 OS: windows xp
Roadmaps: (Not assigned)    
Subscription  


 [2010-02-09 09:18 UTC] dmagick (Chris Smith)
Description: ------------ After using the windows 5.3.1 installer, I ran run-pear.bat without a problem. pear.bat assumes you'll only ever run it from the install directory. If you try to run it from another directory it says environment variables aren't set. I had to do the same for pecl.bat as well (same reason, same patch). Test script: --------------- C:\>cd \windows\temp C:\WINDOWS\Temp>set PHP PHPRC=C:\PHP\ PHP_PEAR_BIN_DIR=C:\PHP PHP_PEAR_DATA_DIR=C:\PHP\data PHP_PEAR_DOC_DIR=C:\PHP\docs PHP_PEAR_INSTALL_DIR=C:\PHP\pear PHP_PEAR_PHP_BIN=.\php.exe PHP_PEAR_SYSCONF_DIR=C:\PHP PHP_PEAR_TEST_DIR=C:\PHP\tests C:\WINDOWS\Temp>set PATH Path=C:\PHP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\GTK2.0\bin;C:\Program Files\Common Files\GTK\2.0\bin;C:\Program Files\CVSN T\ PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH C:\WINDOWS\Temp>pear help 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 C:\WINDOWS\Temp> Expected result: ---------------- Output from pear :) Actual result: -------------- Patch is simple. $ diff -ub pear.bat.orig pear.bat --- pear.bat.orig 2010-02-09 14:58:35.000000000 +1100 +++ pear.bat 2010-02-09 15:02:35.000000000 +1100 @@ -31,6 +31,7 @@ IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=C:\PHP\pear" IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=C:\PHP" IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=.\php.exe" + GOTO :INSTALLED :NOTINSTALLED @@ -77,7 +78,8 @@ IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2 IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR -IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR +IF NOT EXIST "%PHP_PEAR_BIN_DIR%\%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR + REM launch pearcmd GOTO RUN :PEAR_INSTALL_ERROR @@ -110,6 +112,6 @@ ECHO %PHP_PEAR_PHP_BIN% GOTO END :RUN -"%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 +"%PHP_PEAR_BIN_DIR%\%PHP_PEAR_PHP_BIN%" -C -d output_buffering=1 -d safe_mode=0 -d open_basedir="" -d auto_prepend_file="" -d auto_append_file="" -d variables_order=EGPCS -d register_argc_argv="On" -d include_path="%PHP_PEAR_INSTALL_DIR%" -f "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 :END @ECHO ON

Comments

 [2010-04-09 22:28 UTC] dufuz (Helgi Þormar Þorbjörnsson)
Are you sure that the %PHP_PEAR_PHP_BIN% is set to .\php.exe in your bat file? For me it's the full path that's saved there already and thus using your patch means that it breaks. Especially since %PHP_PEAR_BIN_DIR% is used for PEAR binaries and not PHP ones - In theory PHP and PEAR can be installed into two completely separate directories. How did you install your setup?
 [2010-04-09 22:31 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Assigned To: +Assigned To: dufuz
 [2010-04-27 05:13 UTC] dmagick (Chris Smith)
I used the 'php-5.3.1-nts-Win32-VC9-x86.msi' file to install. I installed in a different directory to the default (c:\php instead of c:\program files\php). I chose 'No web server', then added 'pear' to the list of things to install. I double clicked on 'go-pear.bat' to run it and accepted all the defaults and hit enter for each option. Same result.
 [2010-04-30 08:01 UTC] dufuz (Helgi Þormar Þorbjörnsson)
You picked to install PEAR in the MSI but also used go-pear.bat? Did the MSI not install PEAR properly? Thanks for the feedback, will probably have to ask you a few questions when I find more time to tackle this issue :)
 [2010-05-12 04:28 UTC] dmagick (Chris Smith)
I didn't realize that using the msi also set all the pear stuff up when I checked that option (obvious in hindsight, but I thought it just set up the core pear packages rather than everything about pear). Could I suggest a note in the docs then? Thanks for your help.
 [2013-04-12 12:27 UTC] viewport (Jon Wong)
> Especially since %PHP_PEAR_BIN_DIR% is used for PEAR binaries and > not PHP ones - In theory PHP and PEAR can be installed into two > completely separate directories. Only in theory. In practice, it is necessary to copy pearcmd.php into PHP_PEAR_INSTALL_DIR for things to work, thereby breaking the organization that is the scripts folder. All packages (PEAR, Console_Getopt, Archive_Tar, Structures_Graph) installed manually in some exotic location (say C:\exotic\Pierre). You have to set all the PHP_PEAR* variables inside pear.bat, of course. Installed on WAMP, yes.