Help -- Pear Installation problems
| From: | Monique Verrier | Date: | Wed, 03 Nov 2004 20:53:54 +0000 |
| Subject: | Help -- Pear Installation problems | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-15322@lists.php.net to get a copy of this message | ||
Hi -- This is a very weird problem. I couldn't find anybody else with this.
Maybe someone can help. I downloaded the gopear script. I listed it below. I
accessed it with http://localhost/gopear.php and it
didn't execute, it just
displayed the script in the browser. I went to the command prompt and typed
php gopear.php and the results were identical to issuing TYPE GOPEAR.PHP.
I am using php vers 4.3.7. I can go to my basic script:
http://localhost/hello.php and it works fine -- "Hello
World" plus phpinfo()
Thanks in advance for any help.
Monique.
*** LISTING OF GOPEAR.PHP
<?php //; echo; echo "YOU NEED TO RUN THIS SCRIPT WITH PHP NOW!"; echo; echo
"Try this: lynx -source http://pear.php.net/go-pear |
php -q"; echo; exit
# -*- PHP -*- #
+----------------------------------------------------------------------+
# | PHP Version 5 |
# +----------------------------------------------------------------------+
# | Copyright (c) 1997-2004 The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 2.02 of the PHP license, |
# | that is bundled with this package in the file LICENSE, and is |
# | available at through the world-wide-web at |
# | http://www.php.net/license/2_02.txt. |
# | If you did not receive a copy of the PHP license and are unable to |
# | obtain it through the world-wide-web, please send a note to |
# | license@php.net so we can mail you a copy immediately. |
# +----------------------------------------------------------------------+
# | Authors: Tomas V.V.Cox <cox@idecnet.com> |
# | Stig Bakken <ssb@php.net> |
# | Christian Dickmann <dickmann@php.net> |
# | Pierre-Alain Joye <pajoye@pearfr.org> |
# | Greg Beaver <cellog@php.net> |
# +----------------------------------------------------------------------+
# $Id: go-pear,v 1.71 2004/10/25 04:18:17 cellog Exp $
#
# Automatically download all the files needed to run the "pear" command #
(the PEAR package installer). Requires PHP 4.1.0 or newer. # # Installation:
Linux # # This script can either be directly launched or passed via lynx
like this. # # $ lynx -source http://pear.php.net/go-pear
| php # # The
above assumes your php binary is named php and that it's # executable
through your PATH: # # Installation: Windows # # On Windows, go-pear uses
stdin for user input, so you must download # go-pear first and then run it:
# # Note: In PHP 4.2.0-4.2.3, the PHP CLI binary is named php-cli.exe while
since # PHP 4.3.0, it's simply named php.exe in the cli/ folder of your PHP
directory. # The CGI is also named php.exe but it sits directly in your PHP
directory. # # > cli/php -r "readfile('http://pear.php.net/go-pear');" >
go-pear # > cli/php go-pear # # In PHP 5.0.0, the PHP CLI binary is php.exe
# # > php -r "readfile('http://pear.php.net/go-pear');" > go-pear
# > php
go-pear # # Installation: Notes # # - If using the CGI version of PHP,
append the -q option to suppress
# headers in the output.
# - By default, go-pear will install a system-wide configuration file. For
# a local install use:
# > php go-pear local
#
# - Once the go-pear script is initiated, you will see instructions on
# how to continue installing PEAR. The first thing you should see is:
#
# Welcome to go-pear!
#
# Installation: Web browser
#
# You can now use go-pear via a webbrowser, thanks to Christian Dickmann. It
is # still beta codes, but feel free to test it: # 1.: Download the go-pear
script by using the "Save target as ..." function # of your browser here. #
# 2.: Place the go-pear file somewhere under the document root of your
webserver. # The easiest way is to create a new directory for pear and to
put the file in there. # Be sure your web server is setup to recognize PHP,
and that you use an appropriate # extension. For example, you might name
this file gopear.php # # 3.: Access go-pear through your webserver and
follow the instructions. Please # make sure that PHP has write access to the
dir you want to install PEAR into. # For example:
http://localhost/pear/gopear.php # # 4.: After
running go-pear you get a
link to the Web Frontend of the PEAR installer. # I suggest bookmarking this
link. # # 5.: Protect the Web Frontend directory and the go-pear script with
a password. # Use .htaccess on Apache webservers for example. # # $sapi_name
= php_sapi_name(); set_time_limit(0); @ob_end_clean();
ob_implicit_flush(true); define('WEBINSTALLER', ($sapi_name != 'cli' &&
!(substr($sapi_name,0,3)=='cgi' &&
!isset($_SERVER['GATEWAY_INTERFACE']))));
ini_set('track_errors', true);
ini_set('html_errors', WEBINSTALLER); ini_set('magic_quotes_runtime',
false); error_reporting( E_ALL & ~E_NOTICE); define('WINDOWS',
(substr(PHP_OS, 0, 3) == 'WIN')); define('GO_PEAR_VER', '0.5.0');
define('WIN32GUI', !WEBINSTALLER && WINDOWS && $sapi_name=='cli'
&&
which('cscript'));
/*
* See bug #23069
*/
if ( WEBINSTALLER && WINDOWS ) {
$php_sapi_name = win32DetectPHPSAPI();
if($php_sapi_name=='cgi'){
$msg = nl2br("
Sorry! The PEAR installer actually does not work on Windows platform using
CGI and Apache. Please install the module SAPI (see
http://www.php.net/manual/en/install.apache.php
for the
instructions) or use the CLI (cli\php.exe) in the console.
");
displayHTML('error', $msg);
}
}
if (WEBINSTALLER && isset($_GET['action']) && $_GET['action'] ==
'img' &&
isset($_GET['img'])) {
switch ($_GET['img'])
{
case 'note':
case 'pearlogo':
case 'smallpear':
showImage($_GET['img']);
exit;
default:
exit;
};
}
// Check if PHP version is sufficient
if (function_exists("version_compare") && version_compare(phpversion(),
"4.2.0",'<')) {
die("Sorry! Your PHP version is too old. PEAR and this script requires at
least PHP 4.2.0 for stable operation.
It may be that you have a newer version of PHP installed in your web server,
but an older version installed as the 'php' command. In this case, you need
to rebuilt PHP from source.
If your source is 4.2.x, you need to run 'configure' with the --enable-cli
option, rebuild and copy sapi/cli/php somewhere.
If your source is 4.3.x or newer, just make sure you don't run 'configure'
with --disable-cli, rebuilt and copy sapi/cli/php.
Please upgrade PHP to a newer version, and try again. See you then.
");
}
$installer_packages = array(
'PEAR-stable',
'Archive_Tar-stable',
'Console_Getopt-stable',
'XML_RPC-stable'
);
if (WEBINSTALLER) {
$installer_packages[] = 'Pager';
$installer_packages[] = 'HTML_Template_IT';
$installer_packages[] = 'Net_UserAgent_Detect';
$installer_packages[] = 'PEAR_Frontend_Web';
}
$pfc_packages = array(
'DB',
'Net_Socket',
'Net_SMTP',
'Mail',
'XML_Parser',
'PHPUnit'
);
$config_desc = array(
'prefix' => 'Installation prefix',
'bin_dir' => 'Binaries directory',
'php_dir' => 'PHP code directory ($php_dir)',
'doc_dir' => 'Documentation base directory',
'data_dir' => 'Data base directory',
'test_dir' => 'Tests base directory',
);
if(!WEBINSTALLER && WINDOWS){
$config_desc['php_bin'] = 'php.exe path';
}
if (WEBINSTALLER) {
$config_desc['cache_dir'] = 'PEAR Installer cache directory';
$config_desc['cache_ttl'] = 'Cache TimeToLive';
$config_desc['webfrontend_file'] = 'Filename of WebFrontend';
$config_desc['php_bin'] = "php.exe path, optional (CLI command tools)"; }
if (my_env('HTTP_PROXY')) {
$http_proxy = my_env('HTTP_PROXY');
} elseif (my_env('http_proxy')) {
$http_proxy = my_env('http_proxy');
} else {
$http_proxy = '';
}
register_shutdown_function('bail');
detect_install_dirs();
if (WEBINSTALLER) {
@session_start();
/*
See bug #23069
*/
if ( WINDOWS ) {
$php_sapi_name = win32DetectPHPSAPI();
if($php_sapi_name=='cgi'){
$msg = "
Sorry! The PEAR installer actually does not work on Windows platform using
CGI and Apache.
Please install the module SAPI (see
http://www.php.net/manual/en/install.apache.php
for the
instructions) or use the CLI (cli\php.exe) in the console.
";
displayHTML('error', $msg);
exit();
}
}
if (!isset($_SESSION['go-pear']) || isset($_GET['restart'])) {
$_SESSION['go-pear'] = array(
'http_proxy' => $http_proxy,
'config' => array(
'prefix' => dirname(__FILE__),
'bin_dir' => $bin_dir,
'php_bin' => $php_bin,
'php_dir' => '$prefix/PEAR',
'doc_dir' => $doc_dir,
'data_dir' => $data_dir,
'test_dir' => $test_dir,
'cache_dir' => '$php_dir/cache',
'cache_ttl' => 300,
'webfrontend_file' => '$prefix/index.php',
),
'install_pfc' => true,
'DHTML' => true,
);
}
if (!isset($_GET['step'])) {
$_GET['step'] = 'Welcome';
/* clean up old sessions datas */
session_destroy();
}
if ($_GET['step'] == 'install') {
$_SESSION['go-pear']['http_proxy'] =
strip_magic_quotes($_POST['proxy']['host']).':'.strip_magic_quotes($_POST['p
roxy']['port']);
if ($_SESSION['go-pear']['http_proxy'] == ':') {
$_SESSION['go-pear']['http_proxy'] = '';
};
$www_errors = array();
foreach($_POST['config'] as $key => $value) {
$_POST['config'][$key] = strip_magic_quotes($value);
if($key!='cache_ttl'){
if ( empty($_POST['config'][$key]) ) {
if (WEBINSTALLER && $key!='php_bin' ) {
$www_errors[$key] = 'Please fill this path, you can use $prefix, $php_dir or
a full path.';
}
}
}
}
if( sizeof($www_errors)>0){
$_GET['step'] = 'config';
}
$_SESSION['go-pear']['config'] = $_POST['config'];
$_SESSION['go-pear']['install_pfc'] = (isset($_POST['install_pfc'])
&&
$_POST['install_pfc'] == 'on');
$_SESSION['go-pear']['DHTML'] = !($_POST['BCmode'] == "on");
}
$http_proxy = $_SESSION['go-pear']['http_proxy'];
foreach($_SESSION['go-pear']['config'] as $var => $value) {
$$var = $value;
}
$install_pfc = $_SESSION['go-pear']['install_pfc'];
}
if (!WEBINSTALLER) {
$tty = WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty',
'r');
if (!$tty) {
$tty = fopen('php://stdin', 'r');
}
$local = isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] ==
'local';
if ($local) {
$local = "
Running in local install mode
";
} elseif (WINDOWS) {
$local = "
Use 'php " . $_SERVER['argv'][0] . " local' to install a local copy of
PEAR.
";
}
print "Welcome to go-pear!
Go-pear will install the 'pear' command and all the files needed by it. This
command is your tool for PEAR installation and maintenance. $local Go-pear
also lets you download and install the PEAR packages bundled with PHP: " .
implode(', ', $pfc_packages) . ".
If you wish to abort, press Control-C now, or press Enter to continue: ";
fgets($tty, 1024);
print "\n";
print "HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for
none:";
if (!empty($http_proxy)) {
print " [$http_proxy]";
}
print ": ";
$tmp = trim(fgets($tty, 1024));
if (!empty($tmp)) {
$http_proxy = $tmp;
}
}
$origpwd = getcwd();
$config_vars = array_keys($config_desc);
// make indices run from 1...
array_unshift($config_vars, "");
unset($config_vars[0]);
reset($config_vars);
$desclen = max(array_map('strlen', $config_desc));
$descfmt = "%-{$desclen}s";
$first = key($config_vars);
end($config_vars);
$last = key($config_vars);
if (WEBINSTALLER) {
if ( isset($www_errors) && sizeof($www_errors) ) {
displayHTML('config');
exit();
} else {
if (isset($_SESSION['go-pear']['DHTML']) &&
$_SESSION['go-pear']['DHTML'] ==
true && $_GET['step'] == 'install') {
$_GET['step'] = 'preinstall';
}
if ($_GET['step'] != 'install' && $_GET['step'] !=
'install-progress') {
displayHTML($_GET['step']);
exit;
}
if ($_GET['step'] == 'install-progress') {
displayHTMLHeader();
echo "Starting installation ...<br/>";
}
ob_start();
}
}
$progress = 0;
/*
* Checks PHP SAPI version under windows/CLI
*/
if( WINDOWS && !WEBINSTALLER && $php_bin=='') {
print "
We do not find any php.exe, please select the php.exe folder (CLI is
recommanded, usually in c:\php\cli\php.exe) ";
$php_bin_set = false;
} elseif ( WINDOWS && !WEBINSTALLER && strlen($php_bin) ) {
$php_bin_sapi = win32DetectPHPSAPI();
$php_bin_set = true;
switch($php_bin_sapi){
case 'cli':
break;
case 'cgi':
print "
*NOTICE*
We found php.exe under $php_bin, it uses a $php_bin_sapi SAPI. PEAR
commandline tool works well with it, if you have a CLI php.exe available, we
recommand to use it. ";
break;
default:
print "
*WARNING*
We found php.exe under $php_bin, it uses an unknown SAPI. PEAR commandline
tool has not been tested with it, if you have a CLI (or CGI) php.exe
available, we strongly recommand to use it.
";
break;
}
}
####
# Temp stuff
####
tmp_dir();
$foo = $ptmp;
$ptmp = tempnam($foo, 'gope');
if (WINDOWS) {
$ptmp = str_replace($foo,'',$ptmp);
$foo=str_replace("\\\\",'/',$foo);
$s = substr($ptmp,0,1);
if($s=="\\" || $s=='/' ){
$ptmp = $foo.'/'.substr($ptmp,1);
} else {
$ptmp = $foo.'/'.$ptmp;
}
}
rm_rf($ptmp);
mkdir_p($ptmp, 0700);
$ok = @chdir($ptmp);
while (!WEBINSTALLER) {
print "
Below is a suggested file layout for your new PEAR installation. To change
individual locations, type the number in front of the directory. Type 'all'
to change all of them or simply press Enter to accept these locations.
";
foreach ($config_vars as $n => $var) {
printf("%2d. $descfmt : %s\n", $n, $config_desc[$var], $$var);
}
print "\n$first-$last, 'all' or Enter to continue: ";
$tmp = trim(fgets($tty, 1024));
if ( empty($tmp) ) {
if( WINDOWS && !$php_bin_set ){
echo "**ERROR**
Please, enter the php.exe path.
";
} else {
break;
}
}
if (isset($config_vars[(int)$tmp])) {
$var = $config_vars[(int)$tmp];
$desc = $config_desc[$var];
$current = $$var;
if(WIN32GUI){
$tmp = win32BrowseForFolder("$desc [$current] :");
} else {
print "$desc [$current] : ";
$tmp = trim(fgets($tty, 1024));
}
$old = $$var;
if(WINDOWS && $var=='php_bin' ){
if(file_exists($tmp.DIRECTORY_SEPARATOR.'php.exe')){
$tmp = $tmp.DIRECTORY_SEPARATOR.'php.exe';
$php_bin_sapi = win32DetectPHPSAPI();
if($php_bin_sapi=='cgi'){
print "
****************************************************************************
**
NOTICE! We found php.exe under $php_bin, it uses a $php_bin_sapi SAPI. PEAR
commandline tool works well with it. If you have a CLI php.exe available, we
recommand to use it.
";
} elseif ($php_bin_sapi=='unknown') {
print "
****************************************************************************
**
WARNING! We found php.exe under $php_bin, it uses an $php_bin_sapi SAPI.
PEAR commandline tool has not been tested with it. If you have a CLI (or
CGI) php.exe available, we strongly recommand to use it.
";
}
echo "php.exe (sapi: $php_bin_sapi) found.\n\n";
$php_bin_set = true;
} else {
echo "**ERROR**: no php.exe found in this folder.\n";
$tmp='';
}
}
if (!empty($tmp) ) {
$$var = $tmp;
}
} elseif ($tmp == 'all') {
foreach ($config_vars as $n => $var) {
$desc = $config_desc[$var];
$current = $$var;
print "$desc [$current] : ";
$tmp = trim(fgets($tty, 1024));
if (!empty($tmp)) {
$$var = $tmp;
}
}
}
}
foreach ($config_vars as $n => $var) {
foreach ($config_vars as $m => $var2) {
$$var = str_replace('$'.$var2, $$var2, $$var);
}
}
foreach ($config_vars as $var) {
$dir = $$var;
if (!preg_match('/_dir$/', $var)) {
continue;
}
if (!@is_dir($dir)) {
if (!mkdir_p($dir)) {
$root = WINDOWS ? 'administrator' : 'root';
bail("Unable to create {$config_desc[$var]} $dir. Run this script as $root
or pick another location.\n");
}
}
}
if (!WEBINSTALLER) {
$msg = "The following PEAR packages are bundled with PHP: " .
implode(', ', $pfc_packages);
print "\n" . wordwrap($msg, 75) . ".\n";
print "Would you like to install these as well? [Y/n] : ";
$install_pfc = !stristr(fgets($tty, 1024), "n");
print "\n";
}
####
# Download
####
ini_set("include_path", $ptmp);
if (!extension_loaded('zlib') && !WEBINSTALLER) { // In Web context we could
be in multithread env which makes dl() end up with a fatal error.
if (WINDOWS) {
@dl('php_zlib.dll');
} elseif (PHP_OS == 'HP-UX') {
@dl('zlib.sl');
} elseif (PHP_OS == 'AIX') {
@dl('zlib.a');
} else {
@dl('zlib.so');
}
}
if (!extension_loaded('zlib')) {
$urltemplate = 'http://pear.php.net/get/%s?uncompress=yes';
$have_gzip = null;
} else {
$urltemplate = 'http://pear.php.net/get/%s';
$have_gzip = true;
}
print "Loading zlib: ".($have_gzip ? 'ok' : 'failed')."\n";
if (!$have_gzip) {
print "Downloading uncompressed packages\n";
};
if ($install_pfc) {
$to_install = array_merge($installer_packages, $pfc_packages); } else {
$to_install = $installer_packages;
}
displayHTMLProgress($progress = 5);
if (file_exists(dirname(__FILE__).'/go-pear-bundle') ||
is_dir(dirname(__FILE__).'/go-pear-bundle')) {
$dh = @opendir(dirname(__FILE__).'/go-pear-bundle');
}
$local_dir = array();
if ($dh) {
while($file = @readdir($dh)) {
if ($file == '.' || $file == '..' ||
!is_file(dirname(__FILE__).'/go-pear-bundle/'.$file)) {
continue;
};
$local_dir[] = $file;
};
}
foreach ($installer_packages as $pkg) {
foreach($local_dir as $file) {
if (substr($file, 0, strlen(str_replace('-stable', '', $pkg))) ==
str_replace('-stable', '', $pkg)) {
$pkg = str_replace('-stable', '', $pkg);
echo str_pad("Using local package: $pkg", max(38,21+strlen($pkg)+4), '.');
copy(dirname(__FILE__).'/go-pear-bundle/'.$file, $file);
$tarball[$pkg] = $file;
echo "ok\n";
displayHTMLProgress($progress += round(65 / count($to_install)));
continue 2;
};
};
$msg = str_pad("Downloading package: $pkg", max(38,21+strlen($pkg)+4), '.');
print $msg;
$url = sprintf($urltemplate, $pkg);
$pkg = str_replace('-stable', '', $pkg);
$tarball[$pkg] = download_url($url, null, $http_proxy);
print "ok\n";
displayHTMLProgress($progress += round(65 / count($to_install))); }
print 'Bootstrapping: PEAR...................';
$r = 'RELEASE_' . ereg_replace('[^A-Za-z0-9]', '_',
substr(substr($tarball['PEAR'], 5), 0, -4)); $url =
"http://cvs.php.net/co.php/pear-core/PEAR.php?p=1&r=$r";
if (in_array('PEAR.php', $local_dir)) {
copy(dirname(__FILE__).'/go-pear-bundle/PEAR.php', 'PEAR.php');
echo "(local) ";
} else {
download_url($url, 'PEAR.php', $http_proxy);
echo "(remote) ";
}
include_once 'PEAR.php';
print "ok\n";
print 'Bootstrapping: Archive_Tar............';
$r = 'RELEASE_' . ereg_replace('[^A-Za-z0-9]', '_',
substr(substr($tarball['Archive_Tar'], 12), 0, -4)); $url =
"http://cvs.php.net/co.php/pear/Archive_Tar/Archive/Tar.php?p=1&r=$r";
mkdir('Archive', 0700);
if (in_array('Tar.php', $local_dir)) {
copy(dirname(__FILE__).'/go-pear-bundle/Tar.php', 'Archive/Tar.php');
echo "(local) ";
} else {
download_url($url, 'Archive/Tar.php', $http_proxy);
echo "(remote) ";
}
print "ok\n";
print 'Bootstrapping: Console_Getopt.........';
$r = 'RELEASE_' . ereg_replace('[^A-Za-z0-9]', '_',
substr(substr($tarball['Console_Getopt'], 15), 0, -4)); $url =
"http://cvs.php.net/co.php/pear-core/Console/Getopt.php?p=1&r=$r";
mkdir('Console', 0700);
if (in_array('Getopt.php', $local_dir)) {
copy(dirname(__FILE__).'/go-pear-bundle/Getopt.php',
'Console/Getopt.php');
echo "(local) ";
} else {
download_url($url, 'Console/Getopt.php', $http_proxy);
echo "(remote) ";
}
print "ok\n";
if ($install_pfc) {
foreach ($pfc_packages as $pkg) {
foreach($local_dir as $file) {
if (substr($file, 0, strlen($pkg)) == $pkg) {
echo str_pad("Using local package: $pkg", max(38,21+strlen($pkg)+4), '.');
copy(dirname(__FILE__).'/go-pear-bundle/'.$file, $file);
$tarball[$pkg] = $file;
echo "ok\n";
displayHTMLProgress($progress += round(65 / count($to_install)));
continue 2;
};
};
$msg = str_pad("Downloading package: $pkg", max(38,21+strlen($pkg)+4), '.');
print $msg;
$url = sprintf($urltemplate, $pkg);
$tarball[$pkg] = download_url($url, null, $http_proxy);
print "ok\n";
displayHTMLProgress($progress += round(65 / count($to_install)));
}
}
displayHTMLProgress($progress = 70);
PEAR::setErrorHandling(PEAR_ERROR_DIE, "\n%s\n");
print 'Extracting installer..................';
$dot = strrpos($tarball['PEAR'], '.');
$pkg = substr($tarball['PEAR'], 0, $dot);
$ext = substr($tarball['PEAR'], $dot+1);
include_once 'Archive/Tar.php';
$tar = &new Archive_Tar($tarball['PEAR'], $have_gzip);
if (!$tar->extractModify($ptmp, $pkg)) {
bail("failed!\n");
}
print "ok\n";
$tarball['PEAR'] = 'package.xml'; // :-)
include_once "PEAR.php";
include_once "PEAR/Config.php";
include_once "PEAR/Command.php";
include_once "PEAR/Registry.php";
if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] ==
'local') {
$config = &PEAR_Config::singleton($prefix."/pear.conf", ''); } else {
$config = &PEAR_Config::singleton();
};
$config->set('preferred_state', 'stable');
foreach ($config_vars as $var) {
$config->set($var, $$var);
}
$config->store();
$registry = new PEAR_Registry($php_dir);
PEAR_Command::setFrontendType('CLI');
$install = &PEAR_Command::factory('install', $config); $install_options =
array(
'nodeps' => true,
'force' => true,
);
foreach ($tarball as $pkg => $src) {
$options = $install_options;
if ($registry->packageExists($pkg)) {
$options['upgrade'] = true;
}
$install->run('install', $options, array($src));
displayHTMLProgress($progress += round(29 / count($tarball))); }
displayHTMLProgress($progress = 99);
// Base installation finished
ini_restore("include_path");
if (!WEBINSTALLER) {
$sep = WINDOWS ? ';' : ':';
$include_path = explode($sep, ini_get('include_path'));
if (WINDOWS) {
$found = false;
$t = strtolower($php_dir);
foreach($include_path as $path) {
if ($t==strtolower($path)) {
$found = true;
break;
}
}
} else {
$found = in_array($php_dir, $include_path);
}
if (!$found) {
print "
****************************************************************************
**
WARNING! The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified: <$php_dir> If the
specified directory is also not in the include_path used by your scripts,
you will have problems getting any PEAR packages working. ";
if ( $php_ini = getPhpiniPath() ) {
print "\n\nWould you like to alter php.ini <$php_ini>? [Y/n] : ";
$alter_phpini = !stristr(fgets($tty, 1024), "n");
if( $alter_phpini ) {
alterPhpIni($php_ini);
} else {
if (WINDOWS) {
print "
Please look over your php.ini file to make sure
$php_dir is in your include_path.";
} else {
print "
I will add a workaround for this in the 'pear' command to make sure the
installer works, but please look over your php.ini or Apache configuration
to make sure $php_dir is in your include_path. ";
}
}
}
print "
Current include path : ".ini_get('include_path')."
Configured directory : $php_dir
Currently used php.ini (guess) : $php_ini
";
print "Press Enter to continue: ";
fgets($tty, 1024);
}
$pear_cmd = $bin_dir . DIRECTORY_SEPARATOR . 'pear';
$pear_cmd = WINDOWS ? strtolower($pear_cmd).'.bat' : $pear_cmd;
// check that the installed pear and the one in tha path are the same (if
any)
$pear_old = which(WINDOWS ? 'pear.bat' : 'pear', $bin_dir);
if ($pear_old && ($pear_old != $pear_cmd)) {
// check if it is a link or symlink
$islink = WINDOWS ? false : is_link($pear_old) ;
if ($islink && readlink($pear_old) != $pear_cmd) {
print "\n** WARNING! The link $pear_old does not point to the