tags:

views:

84

answers:

4

Hi all,

I have been trying to implement openid functionality into my website. I downloaded the JanRain's library.

I extracted the 'Auth' folder in my classes directory and following the example in the 'example' folder I created the try_auth.php, finish_auth.php, common.php file in the include directory.

Now when I click on the openid selector link I am presented with an error message that says 'openid.php' file not found.

This file is present in the Auth directory.

I corrected it and then I am being presented with a different error which says 'Auth/Yadis/HTTPFetcher.php' not found.

If I sit and change the require path individually in every file in the auth folder then it will take a long time.

my apps directory structure is like this
app
  classes
     Auth (openid library)
  config
  elements
  includes
  views
  webroot
  index.php

Please help me what am I doing wrong. How do I set the includepath so that all the files take their respective paths automatically.

Thanks

A: 

You can set the include path with the set_include_path function call (http://php.net/set_include_path), if that's what you're asking...

Narcissus
A: 

Do a getcwd to find the directory you are in and make the appropiate chdir(s) to resolve your problem. It is a dirty solution but it should work with a minimal effort.

Eineki
I would have done that already if It was able to solve my prob. :-)
Gaurav Sharma
+1  A: 

The files are there you're just not setting the path correctly.

You said this is the path it's looking for 'Auth/Yadis/HTTPFetcher.php' You might need to add the full path, something like this:

/var/www/html/whaterver/Auth/Yadis/HTTPFetcher.php

or

/this/is/where/you/put/the/path/to/the/file/Auth/Yadis/HTTPFetcher.php

just do this command to find the base path and append it to your file path

echo `pwd`;

NOTE: those are backticks not single quotes around the pwd command

EDIT:

You just need to add this to the file that your trying to include into your script.

EXAMPLE:

your file is here: /var/www/html/index.php

and you need to include this file here: /classes/package/files.php

This file: /classes/package/files.php know where all the other files are that come in the package, so no need to edit any of these.

But you do need to edit the /var/www/html/index.php file and add something lie this:

include('/var/www/html/classes/packages/files.php');

once you have this in your script it should know where everything else is.

or as @ax has stated this looks to be a php.ini configuration

Hope this helps

Phill Pafford
Thanks for your answer.:-DDear,There are around 40 files in the 'Auth' folder. You still want me to do this for every file.?If I do this then It will take a really long time. I bet there is a better solution for this. Isn't it.?
Gaurav Sharma
No not for every file but the file that includes those files to your script.
Phill Pafford
+2  A: 

as the documentation states (you don't mention a version, so i am assuming you are using 2.x.x), the Auth/ directory in this package has to be in your PHP include path. there are various ways to do that: php.ini, httpd.conf/.htaccess, ini_set(), ... if you do it in your php.ini, with your apps directory being /path/to/your/app, it would look like that:

; UNIX: "/path1:/path2"
include_path = ".:/php/includes:/path/to/your/app/classes"
;
; Windows: "\path1;\path2" or "c:/path1;c:/path2"
;include_path = ".;c:/php/includes;c:/path/to/your/app/classes"
ax
:-)thanks Mr. axI think your solution seems to be an effective one, will try it soon.thanks for your help. I appreciate it.
Gaurav Sharma