How to add custom or additional path to the open_basedir option for Plesk domain?

Follow

Comments

17 comments

  • Avatar
    Raheel Ansari

    I ran in to an issue with with my magento 1.7 installation on Plesk ONYX. It was running for a while but the admin section of magento became very slow suddenly last week. After checking error logs I discovered it was an issue with directive set in open_basedir. What are Plesk's recommendations for proper configuration of open_basedir for magento. Which directories should be included.

    0
    Comment actions Permalink
  • Avatar
    Denis Bykov

    @Raheel Ansari

    Unless Magento installation is heavily customized, including web space root directory and system temporary directory (as in default settings in Plesk) is sufficient.
    Could you share the exact error message with me? You may change the actual domain name to 'example.com'.

    0
    Comment actions Permalink
  • Avatar
    Mark Anderson

    I thought for Windows you need to use a  semicolon (;)  as a separator  ?

    Files in the specified directories can be accessed by PHP scripts. To separate directories, use a colon (:) on Linux and a semicolon (;) on Windows.

    Cheers

     

     

    0
    Comment actions Permalink
  • Avatar
    Daria Gavrilova

    Hello @Mark Anderson,

    Thank you for your input!

    The article was modified on this matter.

    0
    Comment actions Permalink
  • Avatar
    Giorgio De Fiore

    Hi: I am trying to add some directives to the open_basedir field in Plesk 17.8.11 on CentOS and it seems like the field has a character limit: if I exceed more or less 1000 char the system throws an error and doesen't add the last part of the directives

    The error is

    phpinimng failed: configuration test '/opt/plesk/php/5.6/sbin/php-fpm --test' failed with code 78, and message: PHP: syntax error, unexpected $end, expecting TC_DOLLAR_CURLY or TC_QUOTED_STRING or '"' in Unknown on line 2 [26-Jun-2019 12:33:36] ERROR: Unable to include /opt/plesk/php/5.6/etc/php-fpm.d/mypress.it.conf from /opt/plesk/php/5.6/etc/php-fpm.conf at line 33 [26-Jun-2019 12:33:36] ERROR: failed to load configuration file '/opt/plesk/php/5.6/etc/php-fpm.conf' [26-Jun-2019 12:33:36] ERROR: FPM initialization failed

    Any clues?

    Thanks a lot

    0
    Comment actions Permalink
  • Avatar
    Alexey Lapshin

    Hello, @Giorgio

    The "open_basedir" parameter value should consist of one line.
    The error you faced happens when attempting to enter multi-lines value. Looks like you paste string that including the newline (line feed) character.

    0
    Comment actions Permalink
  • Avatar
    turgut kalfaoglu

    Is there a way to add a path, say /usr/share/GeoIP to open_basedir  GLOBALLY for all PHP versions? That's what I'm struggling with right now.

     

    0
    Comment actions Permalink
  • Avatar
    turgut kalfaoglu

    It appears TRAILING slash is required for the open_basedir?

    Likewise many domains have different syntaxes. I wonder which one is correct:

    open_basedir = "{DOCROOT}/:/tmp/"

    open_basedir = "{WEBSPACEROOT}{/}{:}{TMP}{/}

     

    0
    Comment actions Permalink
  • Avatar
    Alexander Tsmokalyuk (Edited )

    Hello turgut kalfaoglu,

    The following syntax is correct and is offered by Plesk on PHP Settings screen when you expand open_basedir drop-down list:

    {DOCROOT}{/}{:}{TMP}{/}

    {WEBSPACEROOT}{/}{:}{TMP}{/}

    TMP here should be placed into curly brackets since this is a placeholder for real physical path on file system.

    /example/path in the article Answer section is specified without brackets because it is already a real path

    0
    Comment actions Permalink
  • Avatar
    Ehud Ziegelman

    To the best of my understanding, for Ubuntu, it should be:

     

    {WEBSPACEROOT}{/}{:}{TMP}{/}{:}/var/lib/php/sessions

     

    And, possibly, not as described.

    1
    Comment actions Permalink
  • Avatar
    Luca Ferrarese

    I can't solve this problem.
    Domain that run the script is: domain1.com


    Warning
    : include_once(): open_basedir restriction in effect. File(/var/www/vhosts/domain2.com/app.domain2.com/_server/_class/select_dollaro.php) is not within the allowed path(s): (/var/www/vhosts/domain1.com/:/tmp/:/var/www/vhosts/domain2.com/app.domain2.com)

    Any idea?

    0
    Comment actions Permalink
  • Avatar
    Ehud Ziegelman

    Hi Luca,

    It sounds to me, that your domains mix one with the other. This may happen in code (php/js/css...) or in data base links, as in wp-options.

    Also, you may add various links to opesbasedir. Do you know how to do so?

    0
    Comment actions Permalink
  • Avatar
    Luca Ferrarese

    Hi Ehud,
    Plesk->domain1.com->PHP settings->open_basedir = {WEBSPACEROOT}{/}{:}{TMP}{/}{:}/var/www/vhosts/domain2.com/app.domain2.com

    On domain1.com/test.php i have include_once("/var/www/vhosts/domain2.com/app.domain2.com/_server/_class/select_dollaro.php");

    And this is the warning:

    Warning: include_once(): open_basedir restriction in effect. File(/var/www/vhosts/domain2.com/app.domain2.com/_server/_class/select_dollaro.php) is not within the allowed path(s): (/var/www/vhosts/domain1.com/:/tmp/:/var/www/vhosts/domain2.com/app.domain2.com)

    On warning message i see all path allowed and it seems right.
    I need change something else on PHP settings?
    Thanks

    0
    Comment actions Permalink
  • Avatar
    Ehud Ziegelman

    Can you test the openbasedir with a link ending with a slash without the file itself?

    Also, due to cookie security policy , can you fix the resources used on each domain to point Only to the sane donain, not mixing between the two?

    0
    Comment actions Permalink
  • Avatar
    Luca Ferrarese

    Same Warning with open_basedir without slash at the end.
    PHP file call correctly another php file at the same domain. 
    The goal is to call a script php from a different domain of same server... but, is it this possibile?

    0
    Comment actions Permalink
  • Avatar
    Ehud Ziegelman (Edited )

    Hi Luca,

    Please note, I'm a user and Not a support team member.

    On my basedir there is NO slash at the end of the root to 'end' directory. It looks like this:

    {WEBSPACEROOT}{/}{:}{TMP}{/}{:}/var/lib/php/sessions{:}/var/www/vhosts/example.com/httpdocs/wp-content/plugins/ninjafirewall/lib{:}/var/www/vhosts/example.com/httpdocs/wp-content/uploads/2018/12{:}/wp-content/uploads/2018/12

     

    If this doesn't solve the issue, you may open a support ticket, or use talk.plesk.com

     

    Note, possibly there is a block on domain level, from using external resources.

     

     

    0
    Comment actions Permalink
  • Avatar
    eamon

    not working

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request