kb: how-to
ABT: Group A
Applicable to:
- Plesk Onyx for Linux
- Plesk Onyx for Windows
Question
How to add custom or additional path to open_basedir
option for Plesk domain?
Answer
-
Log into Plesk
-
Go to Domains > example.com > PHP Settings
-
Define the custom path:
For Linux:
CONFIG_TEXT: {WEBSPACEROOT}{/}{:}{TMP}{/}{:}/example/path
For Windows:
CONFIG_TEXT: {WEBSPACEROOT}{/}{:}{TMP}{/}{;}C:\example\path
Note: specify actual custom path instead of examples. It is possible to append several paths.
- Press OK to apply the settings
Comments
17 comments
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.
@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'.
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
Hello @Mark Anderson,
Thank you for your input!
The article was modified on this matter.
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
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.
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.
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}{/}
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
To the best of my understanding, for Ubuntu, it should be:
And, possibly, not as described.
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?
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?
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:
On warning message i see all path allowed and it seems right.
I need change something else on PHP settings?
Thanks
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?
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?
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.
not working
Please sign in to leave a comment.