• 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

Question open_basedir plesk error

certurt22

New Pleskian
Server operating system version
OVH VPS
Plesk version and microupdate number
Obsidian 18.0.26
I'm attempting to load a script from a different webspace within Plesk. I've enabled `open_basedir` in the webspace settings, and in my script, I'm using the following line:

```php
include "/var/www/vhosts/krsoft/httpdocs/app/";
```

However, this isn't functioning as expected, and I'm encountering the subsequent errors in my log:

```
mod_fcgid: stderr: PHP Warning: include(/var/www/vhosts/krsoft/httpdocs/eshop): failed to open stream: No such file or directory in /var/www/vhosts/test.example.com/httpdocs/index.php on line 2

mod_fcgid: stderr: PHP Warning: include(/var/www/vhosts/krsoft/httpdocs/app): failed to open stream: No such device in /var/www/vhosts/test.example.com/httpdocs/index.php on line 2

mod_fcgid: stderr: PHP Warning: include(): Failed opening '/var/www/vhosts/krsoft/httpdocs/app/' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/test.example.com/httpdocs/index.php on line 2
```

I'm guessing that the issue might be with the way I'm specifying the file path. I'm having trouble understanding the correct format to use. This error often causes issues on [redacted], and I need help to resolve the problem.
 
Last edited by a moderator:
Thank you for posting. At the moment we only see that something does not work correctly. Could you please also show the lines in your script, because these are crucial to determine what is wrong in the script.

In general I can strongly discourage loading resources across subscriptions this way, because despite an open_basedir permission, the file owner of the read file is still different. It is just a bad practice doing this.
 
I don't know how to demonstrate the example. If you could visit [redacted], you would see that the error page appears on its own after refreshing for a certain period of time.
 
Last edited by a moderator:
Seeing the error won't help the case. For sure there is an error as you say, but to solve it it will be necessary to see the script lines that try to access the file.
 
Back
Top