开发者

OpenId library (include files are not found by script)

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开发者_StackOverflow中文版 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


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"


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


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...


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜