OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



open_basedir restriction in effect

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

open_basedir restriction in effect

Postby rajiv » Thu Jan 31, 2013 4:55 am

hi friends,

As i login as journal manager, while click generic pulgins under system plugins, i getting following error :

ojs2 has produced an error
Message: WARNING: file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/variables.php) is not within the allowed path(s): (C:\Inetpub)
In file: C:\inetpub\wwwroot\ojs\plugins\generic\openAds\OpenAdsConnection.inc.php
At line: 43
Stacktrace:
Server info:
OS: WINNT
PHP Version: 5.2.17
Apache Version: N/A
DB Driver: mysql
DB server version: 5.0.27-community-nt

please help me....

Regards
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: open_basedir restriction in effect

Postby asmecher » Thu Jan 31, 2013 10:02 am

Hi Rajiv,

See e.g. http://pkp.sfu.ca/support/forum/viewtopic.php?p=7048#p7048.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8867
Joined: Wed Aug 10, 2005 12:56 pm

Re: open_basedir restriction in effect

Postby rajiv » Fri Feb 01, 2013 3:36 am

hi alec,

Thanks for your help on this. I saw the link what you were given. but i am unable to understand & also following .htaccess example link also not working
http://www.cs.dal.ca/studentservices/fa ... cess.shtml.
so please give some more solution on this error [open_basedir restriction in effect]


Regards
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: open_basedir restriction in effect

Postby asmecher » Fri Feb 01, 2013 9:20 am

Hi Rajiv,

This is an issue with your PHP configuration, and the details of modifying that will depend on your server's particulars. (Some hosts allow .htaccess overrides to PHP configuration, some do not.) Alternately, if you move your OJS files path within the existing open_basedir list (C:\Inetpub), that should solve the problem -- but make sure you're not accidentally exposing that directory via the web.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8867
Joined: Wed Aug 10, 2005 12:56 pm

Re: open_basedir restriction in effect

Postby rajiv » Mon Feb 04, 2013 3:06 am

hi Alec,

Thanks for your response & suggestion. My OJS files are already there under " C:\inetpub\wwwroot\ " path, but its getting same error. And
also if set none value to "open_basedirectory " in php configuration file, then its working. is it correct way of what i done ?


Regards
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: open_basedir restriction in effect

Postby asmecher » Mon Feb 04, 2013 10:20 am

Hi Rajiv,

It sounds like you have disabled the open_basedir restriction, which is one way of resolving the problem. Note that most hosts don't use open_basedir restrictions.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8867
Joined: Wed Aug 10, 2005 12:56 pm

Re: open_basedir restriction in effect

Postby rajiv » Mon Feb 04, 2013 9:33 pm

hi alec,
thank you for all the help.



Regards
Rajiv
rajiv
 
Posts: 31
Joined: Tue Dec 18, 2012 2:55 am

Re: open_basedir restriction in effect

Postby shoorick » Thu Nov 28, 2013 3:39 am

I met same problem under FreeBSD 8.2-RELEASE + Apache 2.2 + PHP 5.3.10 + OJS 2.4.2 at http://path.to/journal/manager/plugins:
Code: Select all
ojs2 has produced an error
  Message: WARNING: file_exists() [function.file-exists]: open_basedir restriction in effect. File(plugins/generic/.gitignore/index.php) is not within the allowed path(s): (/usr/local/www/data/Journalvestnik/:/usr/local/lib/php:/tmp:/var/tmp)
  In file: /usr/local/www/data/Journalvestnik/lib/pkp/classes/plugins/PluginRegistry.inc.php
  At line: 220
  Stacktrace:
   File: (unknown) line (unknown)
     Function: PKPApplication->errorHandler(2, "file_exists() [function.file-exists]: open_basedir restriction in effect. File(plugins/generic/.gitignore/index.php) is not within the allowed path(s): (/usr/local/www/data/Journalvestnik/:/usr/local/lib/php:/tmp:/var/tmp)", "/usr/local/www/data/Journalvestnik/lib/pkp/classes/plugins/PluginRegistry.inc.php", 220, Array(7))
   File: /usr/local/www/data/Journalvestnik/lib/pkp/classes/plugins/PluginRegistry.inc.php line 220
     Function: file_exists("plugins/generic/.gitignore/index.php")
   File: /usr/local/www/data/Journalvestnik/lib/pkp/classes/plugins/PluginRegistry.inc.php line 120
     Function: PluginRegistry->_instantiatePlugin("generic", "plugins/generic", ".gitignore")
   File: /usr/local/www/data/Journalvestnik/pages/manager/PluginHandler.inc.php line 52
     Function: PluginRegistry->loadCategory("generic")
   File: (unknown) line (unknown)
     Function: PluginHandler->plugins(Array(0), Object(Request))
   File: /usr/local/www/data/Journalvestnik/lib/pkp/classes/core/PKPRouter.inc.php line 361
     Function: call_user_func(Array(2), Array(0), Object(Request))
   File: /usr/local/www/data/Journalvestnik/lib/pkp/classes/core/PKPPageRouter.inc.php line 219
     Function: PKPRouter->_authorizeInitializeAndCallRequest(Array(2), Object(Request), Array(0), False)
   File: /usr/local/www/data/Journalvestnik/lib/pkp/classes/core/Dispatcher.inc.php line 133
     Function: PKPPageRouter->route(Object(Request))
   File: /usr/local/www/data/Journalvestnik/lib/pkp/classes/core/PKPApplication.inc.php line 190
     Function: Dispatcher->dispatch(Object(Request))
   File: /usr/local/www/data/Journalvestnik/index.php line 63
     Function: PKPApplication->execute()
  Server info:
   OS: FreeBSD
   PHP Version: 5.3.10
   Apache Version: Apache
   DB Driver: mysql
Error occured when checking existing of some/non-existent/path/file.

I added additional directory checking before file checking into function _instantiatePlugin defined in lib/pkp/classes/plugins/PluginRegistry.inc.php:
Code: Select all
Index: lib/pkp/classes/plugins/PluginRegistry.inc.php
===================================================================
--- lib/pkp/classes/plugins/PluginRegistry.inc.php   (revision 4897)
+++ lib/pkp/classes/plugins/PluginRegistry.inc.php   (working copy)
@@ -217,7 +217,7 @@
       // Try the plug-in wrapper first for backwards
       // compatibility.
       $pluginWrapper = "$pluginPath/index.php";
-      if (file_exists($pluginWrapper)) {
+      if (is_dir($pluginPath) && file_exists($pluginWrapper)) {
          $plugin = include($pluginWrapper);
          if ($classToCheck) {
             assert(is_a($plugin, $classToCheck));
@@ -226,7 +226,7 @@
          // Try the well-known plug-in class name next.
          $pluginClassName = ucfirst($file).ucfirst($category).'Plugin';
          $pluginClassFile = $pluginClassName.'.inc.php';
-         if (file_exists("$pluginPath/$pluginClassFile")) {
+         if (is_dir($pluginPath) && file_exists("$pluginPath/$pluginClassFile")) {
             // Try to instantiate the plug-in class.
             $pluginPackage = 'plugins.'.$category.'.'.$file;
             $plugin =& instantiate($pluginPackage.'.'.$pluginClassName, $pluginClassName, $pluginPackage, 'register');
Now error disappears.

P. S. How to make pull request which will contain latest commit only without previous?
shoorick
 
Posts: 7
Joined: Wed Nov 13, 2013 9:59 pm
Location: Chelyabinsk, Russia

Re: open_basedir restriction in effect

Postby asmecher » Thu Nov 28, 2013 10:33 am

Hi shoorick,

The .gitignore file doesn't ship with OJS -- but I think your change is probably broadly useful. Have a look at http://stackoverflow.com/questions/5256021/send-a-pull-request-on-github-for-only-latest-commit for sending a pull request from a specific commit.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8867
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 3 guests