Page 1 of 1

how can I install pear modeules in xampp?

PostPosted: 25. March 2009 16:57
by robert_anisoiu
Hello,

I have installed xampp on my computer and now I need to install PEAR modules.

If I ran "go-pear.bat" I receive the error "Manifest length read was 1236 sould be 678716787" and it stops.

I need to install PEAR modules in order to install an open source application.

Can anybody help me?

Regards,
Robert

Re: how can I install pear modeules in xampp?

PostPosted: 26. March 2009 02:18
by Izzy
At a command prompt type
cd C:\xampp\php
Then type
pear.bat
and it will give a list of commands to use and if you type
pear.bat list
it will give a list of installed packages in the default channel for example.

Re: how can I install pear modeules in xampp?

PostPosted: 26. March 2009 09:05
by robert_anisoiu
Hello,

thank you for your response. I succeded to instal several packages but I cannot find the package for "DB/Pager.php" and the package for "[Auth/HTTP.php]". Any idea what is the name of this packages because I cannot continue with the installation of my application.

Thanks,
Robert

Re: how can I install pear modeules in xampp?

PostPosted: 26. March 2009 10:23
by Izzy
Robert,
The package name for DB\pager.php is DB_Pager
The package name for Auth\HTTP.php is Auth_HTTP


First update the pear.php.net channel:
C:\xampp\php>pear.bat channel-update pear.php.net

Shows this when complete:
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded
C:\xampp\php>



Download and install the packages:
C:\xampp\php>pear.bat install DB_Pager

Shows this when finished
WARNING: "pear/DB_Pager" is deprecated in favor of "pear/Pager"
downloading DB_Pager-0.7.tgz ...
Starting to download DB_Pager-0.7.tgz (3,447 bytes)
....done: 3,447 bytes
install ok: channel://pear.php.net/DB_Pager-0.7
C:\xampp\php>



C:\xampp\php>pear.bat download Auth_HTTP

Shows this when finished:
downloading Auth_HTTP-2.1.6.tgz ...
Starting to download Auth_HTTP-2.1.6.tgz (9,327 bytes)
.....done: 9,327 bytes
install ok: channel://pear.php.net/Auth_HTTP-2.1.6
C:\xampp\php>


The WARNING is why it is not included in the latest XAMPP releases and I believe XAMPP version 1.6.8 was the last version that included this package.

Now check the PEAR\DB folder and the PEAR\Auth folder contain the relevant php files you require.

BTW in XAMPP 1.7.0 the pager.php and the HTTP.php files are both in xampp\php\PEAR folder and I believe these 2 files are the new versions that have replaced the deprecated files you are trying to install above.

Please let me know back if you manage to install the packages in your XAMPP version 1.7.0.
Thanks.

Re: how can I install pear modeules in xampp?

PostPosted: 26. March 2009 12:59
by robert_anisoiu
Thanks a lot, Izzy. I succesed in installation of PEAR packages.

Regards,
Robert

Re: how can I install pear modeules in xampp?

PostPosted: 26. March 2009 13:06
by Izzy
You are welcome Robert and thanks for posting back.

I hope now you can install your app. without too much trouble.

Good luck.

Re: how can I install pear modeules in xampp?

PostPosted: 20. May 2009 15:12
by manddox
Hi izzy,

You believe XAMPP version 1.6.8 was the last version that included this package(DB_Pager and Auth_HTTP). And in XAMPP 1.7.0 the pager.php and the HTTP.php files are both in xampp\php\PEAR folder and you also said that these 2 files are the new versions that have replaced the deprecated files which our friend was trying to install above.

Now, I am using XAMPP for Windows Version 1.7.1. Like you said I see the two files, pager.php and the HTTP.php in xampp\php\PEAR folder. So, should i understand that i don't need to install those packages as i am already using a new version which according to you has replaced the deprecated files in the earlier version??

Below is the code in which I am using Auth_HTTP to authenticate a user and there it has reference to Auth/HTTP.php file and to the Auth_HTTP function but it gives me an error with a warning which are posted below:

Code: Select all
<?php
// Using Auth_HTTP to limit access
require_once('db_login.php');
require_once("Auth/HTTP.php");
// We use the same connection string as the pear DB functions
$AuthOpts = array('dsn' => "mysql://$db_username:$db_password@$db_host/$db_database",
'table' => "users", // your table name
'usernamecol' => "username", // the table username column
'passwordcol' => "password", // the table password column
'cryptType' => "md5" // password encryption type
);
$authenticate = new Auth_HTTP("DB", $AuthOpts);// Set the realm name
$authenticate->setRealm('Member Area');
// Authentication failed error message
$authenticate->setCancelText('<h2>Access Denied</h2>');
// Request authentication
$authenticate->start( );
// Compare username and password to stored values
if ($authenticate->getAuth( ))
{
echo "Welcome back to our site ".$authenticate->username.".";
}
?>


Warning: require_once(Auth/HTTP.php) [function.require-once]: failed to open stream: No such file or directory in D:\Program Files\xampp\htdocs\authenticate.php on line 4

Fatal error: require_once() [function.require]: Failed opening required 'Auth/HTTP.php' (include_path='.;D:\Program Files\xampp\php\pear\') in D:\Program Files\xampp\htdocs\authenticate.php on line 4

Please suggest a clue to how I can get rid of this error and get this code running.

Re: how can I install pear modules in xampp?

PostPosted: 20. May 2009 16:31
by manddox
I think i got some clue here....

This version of xampp 1.7.1 does not include the Auth_HTTP module and has only the Auth module. And so when i exclude this constructor 'Auth_HTTP()' from my code, I am able to run the authentication.

Here is my new code:
Code: Select all
<?php
// Using Auth_HTTP to limit access
require_once('db_login.php');
require_once("Auth.php");
// We use the same connection string as the pear DB functions
$AuthOpts = array('dsn' => "mysql://$db_username:$db_password@$db_host/$db_database",
'table' => "users", // your table name
'usernamecol' => "username", // the table username column
'passwordcol' => "password", // the table password column
'cryptType' => "md5" // password encryption type
);
$authenticate = new Auth("DB", $AuthOpts);// Set the realm name
//$authenticate->setRealm('Member Area');
// Authentication failed error message
//$authenticate->setCancelText('<h2>Access Denied</h2>');
// Request authentication
$authenticate->start( );
// Compare username and password to stored values
if ($authenticate->getAuth( ))
{
echo "Welcome back to our site ".$authenticate->username.".";
}
?>


Here above, the two functions setRealm() and setCancelText() are from the Auth_HTTP module and so they do not work when I call the constructor Auth_HTTP(). So I changed that to Auth() and I require only the file Auth.php. And then I got lucky and got the login page.

Re: how can I install pear modeules in xampp?

PostPosted: 19. February 2010 14:53
by scanreg
Thanks izzy for the pear package install instructions :)

Re: how can I install pear modeules in xampp?

PostPosted: 20. February 2010 20:42
by MC10
Thanks, this was very useful.