pear.bat 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. @ECHO OFF
  2. REM ----------------------------------------------------------------------
  3. REM PHP version 5
  4. REM ----------------------------------------------------------------------
  5. REM Copyright (c) 1997-2010 The Authors
  6. REM ----------------------------------------------------------------------
  7. REM http://opensource.org/licenses/bsd-license.php New BSD License
  8. REM ----------------------------------------------------------------------
  9. REM Authors: Alexander Merz (alexmerz@php.net)
  10. REM ----------------------------------------------------------------------
  11. REM
  12. REM Last updated 12/29/2004 ($Id$ is not replaced if the file is binary)
  13. REM change this lines to match the paths of your system
  14. REM -------------------
  15. REM Test to see if this is a raw pear.bat (uninstalled version)
  16. SET TMPTMPTMPTMPT=@includ
  17. SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@
  18. FOR %%x IN ("D:\phpstudy_pro\WWW\laravel-app\pear") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED)
  19. REM Check PEAR global ENV, set them if they do not exist
  20. IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=D:\phpstudy_pro\WWW\laravel-app\pear"
  21. IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=D:\phpstudy_pro\WWW\laravel-app"
  22. IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=D:\phpstudy_pro\Extensions\php\php7.3.4nts\\php.exe"
  23. GOTO :INSTALLED
  24. :NOTINSTALLED
  25. ECHO WARNING: This is a raw, uninstalled pear.bat
  26. REM Check to see if we can grab the directory of this file (Windows NT+)
  27. IF %~n0 == pear (
  28. FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" (
  29. SET "PHP_PEAR_PHP_BIN=%%~$PATH:x"
  30. echo Using PHP Executable "%PHP_PEAR_PHP_BIN%"
  31. "%PHP_PEAR_PHP_BIN%" -v
  32. GOTO :NEXTTEST
  33. ))
  34. GOTO :FAILAUTODETECT
  35. :NEXTTEST
  36. IF "%PHP_PEAR_PHP_BIN%" NEQ "" (
  37. REM We can use this PHP to run a temporary php file to get the dirname of pear
  38. echo ^<?php $s=getcwd^(^);chdir^($a=dirname^(__FILE__^).'\\'^);if^(stristr^($a,'\\scripts'^)^)$a=dirname^(dirname^($a^)^).'\\';$f=fopen^($s.'\\~a.a','wb'^);echo$s.'\\~a.a';fwrite^($f,$a^);fclose^($f^);chdir^($s^);?^> > ~~getloc.php
  39. "%PHP_PEAR_PHP_BIN%" ~~getloc.php
  40. set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a
  41. DEL ~a.a
  42. DEL ~~getloc.php
  43. set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear"
  44. REM Make sure there is a pearcmd.php at our disposal
  45. IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php (
  46. IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
  47. IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
  48. IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php
  49. )
  50. )
  51. GOTO :INSTALLED
  52. ) ELSE (
  53. REM Windows Me/98 cannot succeed, so allow the batch to fail
  54. )
  55. :FAILAUTODETECT
  56. echo WARNING: failed to auto-detect pear information
  57. :INSTALLED
  58. REM Check Folders and files
  59. IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR
  60. IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2
  61. IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR
  62. IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR
  63. REM launch pearcmd
  64. GOTO RUN
  65. :PEAR_INSTALL_ERROR
  66. ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
  67. ECHO Please fix it using your environment variable or modify
  68. ECHO the default value in pear.bat
  69. ECHO The current value is:
  70. ECHO %PHP_PEAR_INSTALL_DIR%
  71. GOTO END
  72. :PEAR_INSTALL_ERROR2
  73. ECHO PHP_PEAR_INSTALL_DIR is not set correctly.
  74. ECHO pearcmd.php could not be found there.
  75. ECHO Please fix it using your environment variable or modify
  76. ECHO the default value in pear.bat
  77. ECHO The current value is:
  78. ECHO %PHP_PEAR_INSTALL_DIR%
  79. GOTO END
  80. :PEAR_BIN_ERROR
  81. ECHO PHP_PEAR_BIN_DIR is not set correctly.
  82. ECHO Please fix it using your environment variable or modify
  83. ECHO the default value in pear.bat
  84. ECHO The current value is:
  85. ECHO %PHP_PEAR_BIN_DIR%
  86. GOTO END
  87. :PEAR_PHPBIN_ERROR
  88. ECHO PHP_PEAR_PHP_BIN is not set correctly.
  89. ECHO Please fix it using your environment variable or modify
  90. ECHO the default value in pear.bat
  91. ECHO The current value is:
  92. ECHO %PHP_PEAR_PHP_BIN%
  93. GOTO END
  94. :RUN
  95. "%PHP_PEAR_PHP_BIN%" -C -d date.timezone=UTC -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
  96. :END
  97. @ECHO ON