Basic HTTP authentication Error

A

Anonymous

Guest
Hi I'm using HTTP authentication in PHP, it works on my local PC but not webserver(paid). The error comes like this ..
Code:
Warning: main(Auth/HTTP.php): failed to open stream: No such file or directory in /public_html/project/admin.php on line 11

Fatal error: main(): Failed opening required 'Auth/HTTP.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /public_html/project/admin.php on line 11

Here is my code ::
Code:
require_once("Auth/HTTP.php");

$AuthOptions = array(
'dsn'=>"mysql://uname:pass@localhost/db",
'table'=>"admin",
'usernamecol'=>"adminID",
'passwordcol'=>"password",
'cryptType'=>"none",
'db_fields'=>"*"      
);

$a = new Auth_HTTP("DB", $AuthOptions);
 
the PEAR installation is not in your PHP include path.
either get that variable fixed or use a full system path eg "/var/lib/php/...."
 
I found HTTP.php but not in Auth folder. I'm using RHEL3 which has PHP4 installed. Pear folder in /usr/share/pear. But when i give the path to HTTP.php i got a msg
Code:
Fatal error: Cannot instantiate non-existent class: auth_http in /var/www/html/admin.php on line 22
 
What is the meaning of this line?
Code:
include_path='.:/usr/lib/php:/usr/local/lib/php'

Which path should i use to get the file/ include as require_once. ?
 
patna_in said:
What is the meaning of this line?
Code:
include_path='.:/usr/lib/php:/usr/local/lib/php'
It means the include path has "/usr/lib/php", "/usr/local/lib/php", and the current working directory.

So if you do ...
Code:
<?php
..
include 'somefile.php';
..
?>

php will try to find the file in current working directory, if not present then /usr/lib/php, and so on...
 
patna_in said:
I found HTTP.php but not in Auth folder. I'm using RHEL3 which has PHP4 installed. Pear folder in /usr/share/pear. But when i give the path to HTTP.php i got a msg
Code:
Fatal error: Cannot instantiate non-existent class: auth_http in /var/www/html/admin.php on line 22

then use
Code:
<?php
require_once("/var/www/html/Auth/HTTP.php");
//or 
require_once("/usr/home/dir/public_html/Auth/HTTP.php");
//depending on your filesystem structure.

//or even
require_once("./Auth/HTTP.php");

?>

remember everything is case sensitive as pertains to the filesystem.
 
Code:
<?php

# OR
# Relative to the directory you're working under

require_once(dirname(__FILE__) . '../Auth/HTTP.php');

# dirname(__FILE__) : Returns current working directory
# Works always

?>
 
Soory vai, I tried all the given infos but i failed every time i got the same message.
Code:
# Warning: main(Auth/HTTP.php): failed to open stream: No such file or directory in /public_html/project/admin.php on line 11
#
# Fatal error: main(): Failed opening required 'Auth/HTTP.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /public_html/project/admin.php on line 11

I again mention my configuration & all configuration r installed auto(during RHEL installation) . I change nothing except run http server from services when i try to run my script on webserver.....

OS : RedHat Enterprise Linux AS 3.0
PHP 4.x
MySQL 3.x.x

PLZ PLZ PLZ, help me i got disappointed. I can't run my script even on Paid WebServer, may be I told u 1st.

n.b. I'm the root of my machine so i've full administrative power so no security problem.
 
Please check you .ini (via phpinfo()) for your DOCUMENT_ROOT. You can see you server path in SCRIPT_FILENAME.
 
I can't do it. I saw my document root is /public_html. The error goes ....
Code:
# # Warning: main(Auth/HTTP.php): failed to open stream: No such file or directory in /public_html/project/admin.php on line 11
# #
# # Fatal error: main(): Failed opening required 'Auth/HTTP.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /public_html/project/admin.php on line 11

Plz :help:
 
Hmm, I think that's the easiest way to solve it but its quite tough for me. By the way, thanks to u all for ur response & advice...
 
patna_in said:
Hmm, I think that's the easiest way to solve it but its quite tough for me. By the way, thanks to u all for ur response & advice...
why don't you personally download the files, unzip the package, and just simply include them, PEAR is no rocket science.
 
Actually its my project work. If its not work on my internet server then how can i think that the code works everywhere. By the way, i include the HTTP.php file in my file but i got msg some thing "class missing...".
 
patna_in said:
If its not work on my internet server then how can i think that the code works everywhere.
ruturajv got the answer!
That way PEAR files will make part of your project files.
You'll have it anywhere and you'll know exactly how to refer (include) them.
This is what i always do when trying/testing/using PEAR classes.
 
why don't you do this.

copy all the pear requirements in
/your/document/root/pear, make sure you maintain the folder structure.

and then...

Code:
ini_set('include_path', '/your/document/root/pear' . PATH_SEPARATOR . ini_get('include_path'));
 
Hi, i got this error ..

I wanna little bit confused what i'm doing is right / wrong?

1. I copy Auth directory & put in my parent folder where my scripts resides. Then the following error occurs

Code:
Fatal error: Class auth_http: Cannot inherit from undefined class auth in /home/monjur/public_html/project/Auth/HTTP.php on line 42

2. I've downloaded the pear from pear.php.net but that folder is more than 10 MB and some dependency needed. I can't upload that big file.

3.
Code:
ini_set('include_path', '/your/document/root/pear' . PATH_SEPARATOR . ini_get('include_path'));
I've added the line in my code 1st line. Plz tell me what i do next.
 
well I can only tell you to try without PEAR packages at your dev. PC, and include only once those are required and then solve the dependecies as reqd. and then upload only them.
 
Back
Top