1@ECHO OFF 2 3REM ---------------------------------------------------------------------- 4REM PHP version 5 5REM ---------------------------------------------------------------------- 6REM Copyright (c) 1997-2004 The PHP Group 7REM ---------------------------------------------------------------------- 8REM This source file is subject to version 3.0 of the PHP license, 9REM that is bundled with this package in the file LICENSE, and is 10REM available at through the world-wide-web at 11REM http://www.php.net/license/3_0.txt. 12REM If you did not receive a copy of the PHP license and are unable to 13REM obtain it through the world-wide-web, please send a note to 14REM license@php.net so we can mail you a copy immediately. 15REM ---------------------------------------------------------------------- 16REM Authors: Alexander Merz (alexmerz@php.net) 17REM ---------------------------------------------------------------------- 18REM 19REM Last updated 02/08/2004 ($Id$ is not replaced if the file is binary) 20 21REM change this lines to match the paths of your system 22REM ------------------- 23 24 25REM Test to see if this is a raw pear.bat (uninstalled version) 26SET TMPTMPTMPTMPT=@includ 27SET PMTPMTPMT=%TMPTMPTMPTMPT%e_path@ 28FOR %%x IN ("@include_path@") DO (if %%x=="%PMTPMTPMT%" GOTO :NOTINSTALLED) 29 30REM Check PEAR global ENV, set them if they do not exist 31IF "%PHP_PEAR_INSTALL_DIR%"=="" SET "PHP_PEAR_INSTALL_DIR=@include_path@" 32IF "%PHP_PEAR_BIN_DIR%"=="" SET "PHP_PEAR_BIN_DIR=@bin_dir@" 33IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=@php_bin@" 34GOTO :INSTALLED 35 36:NOTINSTALLED 37ECHO WARNING: This is a raw, uninstalled pear.bat 38 39REM Check to see if we can grab the directory of this file (Windows NT+) 40IF %~n0 == pear ( 41FOR %%x IN (cli\php.exe php.exe) DO (if "%%~$PATH:x" NEQ "" ( 42SET "PHP_PEAR_PHP_BIN=%%~$PATH:x" 43echo Using PHP Executable "%PHP_PEAR_PHP_BIN%" 44"%PHP_PEAR_PHP_BIN%" -v 45GOTO :NEXTTEST 46)) 47GOTO :FAILAUTODETECT 48:NEXTTEST 49IF "%PHP_PEAR_PHP_BIN%" NEQ "" ( 50 51REM We can use this PHP to run a temporary php file to get the dirname of pear 52 53echo ^<?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 54"%PHP_PEAR_PHP_BIN%" ~~getloc.php 55set /p PHP_PEAR_BIN_DIR=fakeprompt < ~a.a 56DEL ~a.a 57DEL ~~getloc.php 58set "PHP_PEAR_INSTALL_DIR=%PHP_PEAR_BIN_DIR%pear" 59 60REM Make sure there is a pearcmd.php at our disposal 61 62IF NOT EXIST %PHP_PEAR_INSTALL_DIR%\pearcmd.php ( 63IF EXIST %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php COPY %PHP_PEAR_INSTALL_DIR%\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 64IF EXIST pearcmd.php COPY pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 65IF EXIST %~dp0\scripts\pearcmd.php COPY %~dp0\scripts\pearcmd.php %PHP_PEAR_INSTALL_DIR%\pearcmd.php 66) 67) 68GOTO :INSTALLED 69) ELSE ( 70REM Windows Me/98 cannot succeed, so allow the batch to fail 71) 72:FAILAUTODETECT 73echo WARNING: failed to auto-detect pear information 74:INSTALLED 75 76REM Check Folders and files 77IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%" GOTO PEAR_INSTALL_ERROR 78IF NOT EXIST "%PHP_PEAR_INSTALL_DIR%\pearcmd.php" GOTO PEAR_INSTALL_ERROR2 79IF NOT EXIST "%PHP_PEAR_BIN_DIR%" GOTO PEAR_BIN_ERROR 80IF NOT EXIST "%PHP_PEAR_PHP_BIN%" GOTO PEAR_PHPBIN_ERROR 81REM launch pearcmd 82GOTO RUN 83:PEAR_INSTALL_ERROR 84ECHO PHP_PEAR_INSTALL_DIR is not set correctly. 85ECHO Please fix it using your environment variable or modify 86ECHO the default value in pear.bat 87ECHO The current value is: 88ECHO %PHP_PEAR_INSTALL_DIR% 89GOTO END 90:PEAR_INSTALL_ERROR2 91ECHO PHP_PEAR_INSTALL_DIR is not set correctly. 92ECHO pearcmd.php could not be found there. 93ECHO Please fix it using your environment variable or modify 94ECHO the default value in pear.bat 95ECHO The current value is: 96ECHO %PHP_PEAR_INSTALL_DIR% 97GOTO END 98:PEAR_BIN_ERROR 99ECHO PHP_PEAR_BIN_DIR is not set correctly. 100ECHO Please fix it using your environment variable or modify 101ECHO the default value in pear.bat 102ECHO The current value is: 103ECHO %PHP_PEAR_BIN_DIR% 104GOTO END 105:PEAR_PHPBIN_ERROR 106ECHO PHP_PEAR_PHP_BIN is not set correctly. 107ECHO Please fix it using your environment variable or modify 108ECHO the default value in pear.bat 109ECHO The current value is: 110ECHO %PHP_PEAR_PHP_BIN% 111GOTO END 112:RUN 113"%PHP_PEAR_PHP_BIN%" -C -n -d date.timezone=UTC -d output_buffering=1 -d safe_mode=0 -d "include_path='%PHP_PEAR_INSTALL_DIR%'" -d register_argc_argv="On" -d variables_order=EGPCS -f "%PHP_PEAR_INSTALL_DIR%\peclcmd.php" -- %1 %2 %3 %4 %5 %6 %7 %8 %9 114:END 115@ECHO ON