• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Cannot add custom folder to the open_basedir PHP option.

KevinPrimate

New Pleskian
Server operating system version
AlmaLinux 8.8 (Sapphire Caracal)
Plesk version and microupdate number
18.0.58 #2
I have a drupal hosted in my plesk and the private folder is above the {WEBSPACEROOT} route. So it is not possible to add new folders with the default plesk value for the open_basedir configuration. So I tried to add a new route in the open_basedir configuration. I tried to use the absolute path to the private folder, but it did`nt worked, so I started to try from /var (worked), but as soon as I added /var/www it stopped working, so i cannot add the absolute path because it is obviously inside /var/www...

I also tried relative paths and multiple syntaxis for both absolute and relative paths, but nothing worked, and obviously I cannot let the open_basedir option on none or /var.
 
If you're adding it in the open_basedir setting section of the domain though the PHP settings, you should be able to add it like so:

Code:
{WEBSPACEROOT}{/}{:}{TMP}{/}{:}{/}var{/}www{/}test{/}

1710513723111.png
1710513789790.png
 
If you're adding it in the open_basedir setting section of the domain though the PHP settings, you should be able to add it like so:

Code:
{WEBSPACEROOT}{/}{:}{TMP}{/}{:}{/}var{/}www{/}test{/}

View attachment 25760
View attachment 25761
That`s the issue, it is supossed to work, but it does not. If I add like you posted {WEBSPACEROOT}{/}{:}{TMP}{/}{:}{/}var{/}www{/}test{/} , it doesn`t work. If it is only {WEBSPACEROOT}{/}{:}{TMP}{/}{:}{/}var{/} it does, but with the www or deeper directories it just don`t.
 
Where are you pasting it? Copy and paste or show a screen shot of what you are pasting in. What does the PHP Info show as well?
 
Where are you pasting it? Copy and paste or show a screen shot of what you are pasting in. What does the PHP Info show as well?
In the open_basedir configuration. In the screenshot you can see that i have added the /var/www (it doesn`t works) but if i add just /var or just put the open_basedir on none, it works. In my web, I have a form that tries to create a folder on the /src/private/webform/(name of the form)/(new folder), but it can`t create the new folder because the {WEBSPACEROOT} you see is pointing at /src/web.
 

Attachments

  • Captura.PNG
    Captura.PNG
    11.9 KB · Views: 3
I have managed to configure Drupal to operate on files within the private folder while keeping the open_basedir set to its default value.After some research, I discovered that Drupal uses a stream wrapper for the private directory, denoted by "private://". However, for some reason, it is unable to create subfolders using this wrapper on my server. Using absolute paths works correctly. As a temporary solution, I patched one of the Drupal core files to use absolute paths instead of the wrapper.Nevertheless, I would like to understand why this is happening. Is there any configuration I should change to enable the stream wrapper functionality? Modifying the Drupal core files does not seem to be the most efficient option...

To add some context, the change made on the drupal code was changing
Code:
return mkdir($uri, $mode, $recursive, $context);
to
Code:
return mkdir($this->realpath($uri), $mode, $recursive, $context);
 
Back
Top