1

I try to get rid of this persistent and annoying warning message:

Warning: is_dir(): open_basedir restriction in effect. File(/usr/share/pear/api/v3) is not within the allowed path(s): (/var/www/civicrm/htdocs:/var/www/civicrm/apps:/var/www/civicrm/priv:/var/www/civicrm/tmp:/usr/share/php:/tmp) in Civi\API\Provider\MagicFunctionProvider->getEntityNames() (line 106 of /var/www/civicrm/htdocs/drupal/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php).

getEntityNames gets the /usr/share/pear path from the get_include_path(). Where is the /usr/share/pear coming from? The path does not even exist on my Ubuntu 14.04 system. I have been looking everywhere. CiviCRM runs under Drupal, Apache and PHP fastcgi.

1
  • I see three answers here but not anyone conclusive. So what is the best answer?
    – ñull
    Commented Nov 21, 2017 at 10:27

3 Answers 3

1

open_basedir is a PHP setting that limits which files can be accessed by PHP for processing. Its default value invariably is not set to work with CiviCRM and the general recommendation is to disable it.

To disable it, in the httpd.conf file add a php directive: php_admin_value open_basedir none.

More details can be found here: http://php.net/manual/en/ini.core.php#ini.open-basedir

1

I found my own preferred solution.

The default include_path, when not set elsewhere, is in my case .:/usr/share/php:/usr/share/pear It is determined at compile time. It can be overridden everywhere also in the script civicrm.settings.php where it is changed for CiviCRM's purposes:

$include_path = '.'           . PATH_SEPARATOR .
                $civicrm_root . PATH_SEPARATOR .
                $civicrm_root . DIRECTORY_SEPARATOR . 'packages' . PATH_SEPARATOR .
                get_include_path( );

As you can see the compiler default is appended.

Knowing where it is set. We also can find the best solution.

In my case I can simply insert this:

set_include_path('.'.PATH_SEPARATOR.DIRECTORY_SEPARATOR.'usr'.DIRECTORY_SEPARATOR.'share'.DIRECTORY_SEPARATOR.'php');

in civicrm.settings.php somewhere before the previously quoted code. That will remove path that does not exist and does not appear in open_basedir.

0

Sounds like it's guessing the path; Have you tried explicitly adding paths to your civicrm.settings.php

For your CMS path: define CIVICRM_CMSDIR

and double check the: CiviCRM_UF_BASEURL

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.