Aliasing the web content hits "open_basedir restriction in effect" restriction

Problem Description

When following the instructions on the wiki to alias the web content of a domain (which happens to be WordPress), I hit the issue where a 500 error is returned and the following error message.

Any Error Messages

[Tue Nov 05 20:28:50.473174 2019] [php7:warn] [pid 27093] [client [ip]:57636] PHP Warning:  Unknown: open_basedir restriction in effect. File(/srv/example.com/public/htdocs/index.php) is not within the allowed path(s): (/srv/example.org/public/:/srv/example.org/php_tmp/:/srv/example.org/php_sessions/) in Unknown on line 0
[Tue Nov 05 20:28:50.473232 2019] [php7:warn] [pid 27093] [client [ip]:57636] PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0
[Tue Nov 05 20:28:50.473247 2019] [php7:error] [pid 27093] [client [ip]:57636] PHP Fatal error:  Unknown: Failed opening required '/srv/example.org/public/htdocs/index.php' (include_path='.:/usr/share/php') in Unknown on line

Environment

  • Sympl Version [9.0/10.0]: 10.0
  • Debian Version [Buster/Stretch]: Buster
  • Hardware Type? [Dedicated/Virtual/Pi]: Virtual
  • Sympl Testing Version? [Yes/No]: Yes

I’m switching to a simple redirect using the .htaccess instead rather than using WordPress to do the redirect, however worth considering for updating the documentation, or supporting symlinks in this way.

Ah, yes, as the actual target of the symlink is not the public/htdocs directory in the same domain, the PHP restrictions trap it, and prevent the PHP sessions from accessing what looks like ‘elsewhere’.

Creating the file config/disable-php-security for the aliassed site should prevent the restrictions for that site, and allow things to work normally.

I’ll add this to the list of improvements needed when it comes to generating the Apache configurations, and update the docs.

1 Like