Jump to content

Need help with detecting path on server


krembo99

Recommended Posts

Hello all..

 

I have a problem with grabbing a path to document with a php wordpress plugin.

This is the function that requires it:

 

require_once(getenv("DOCUMENT_ROOT").PLUGINPATH.'defaults.php');

 

And this is the warning :

 

Warning: getadminoptions(/web/htdocs/www.mydomainName.com/home//wp-content/plugins/somepluginname/defaults.php) [function.getadminoptions]: failed to open stream: No such file or directory in /web/htdocs/www.krembo99.com/home/m33/wp-content/plugins/somepluginname/somepluginname.php on line 78

Fatal error: getadminoptions() [function.require]: Failed opening required '/web/htdocs/www.mydomainName.com/home//wp-content/plugins/somepluginname/defaults.php' (include_path='.:/php/lib/php/') in /web/htdocs/www.mydomainName.com/home/m33/wp-content/plugins/somepluginname/somepluginname.php on line 78

 

note the DOUBLE slashes after "..mydomainName.com/home//wp-content/.." , but the real path is the one indicated below , EG : "..mydomainName.com/home/m33/wp-content/.."

So I guess the environmental VAR used [getenv("DOCUMENT_ROOT")] is wrong (because it is not installed at the root but under "m33" but since I am far from being a PHP guru, I do not know which VAR I can use, or HOW to fix this problem.

 

anyone ?

 

Link to comment
https://forums.phpfreaks.com/topic/109247-need-help-with-detecting-path-on-server/
Share on other sites

Ok, I have temporarly solved the problem by changing the :

define("PLUGINPATH", "/wp-content/plugins/autoblogged/");

to

define("PLUGINPATH", "[color=red]m33[/color]/wp-content/plugins/autoblogged/");

 

but still, how can I change it to something that will AUTODETECT the path ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.