roots / acorn

Laravel components for WordPress plugins and themes
https://roots.io/acorn/
MIT License
819 stars 94 forks source link

Sage10 dev-master: open_basedir restriction in effect. File(/) is not within the allowed path #140

Closed sgatz closed 2 years ago

sgatz commented 3 years ago

Description

On a fresh new theme of Sage 10 from dev-master when I deploy it to a live server (AWS EC2) using Trellis/Bedrock, then either activate it or preview it, you get this error:

production.ERROR: is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/srv/www/:/tmp) {"exception":"[object] (ErrorException(code: 0): is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s):

Other non-sage themes work in this environment, and a fresh install of a sage9 theme works also. I can also turn off open_basedir, but that's not ideal. See full stack trace at bottom. I've tried disabling all plugins, still same error. Non sage plugins work, sage9 works.

Steps to reproduce

  1. create new theme: composer create-project roots/sage your-theme-name dev-master
  2. yarn, yarn build, checkin.
  3. integate into build-before.yml
  4. deploy to server
  5. go to wp admin > appearance > preview this theme OR activate and go to home page of theme

Expected behavior: Expected theme to render

Actual behavior: White screens with above error in storage/logs

Reproduces how often: 100% reproducible. tried on my custom theme and then a fresh install of dev-master

Versions

You can get this information from referencing CHANGELOG.md. Also, please include the OS and what version of the OS you're running.

Additional information

here's the full error, but it doesn't hint at why sage is doing this:

[2021-04-16 21:10:07] production.ERROR: is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/srv/www/:/tmp) {"userId":28,"exception":"[object] (ErrorException(code: 0): is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/srv/www/:/tmp) at /srv/www/servername/releases/20210416210751/web/wp/wp-admin/includes/misc.php:266)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'is_writable(): ...', '/srv/www/into/r...', 266, Array)
roots/sage#1 /srv/www/servername/releases/20210416210751/web/wp/wp-admin/includes/misc.php(266): is_writable('/')
roots/sage#2 /srv/www/servername/releases/20210416210751/web/wp/wp-includes/class-wp-rewrite.php(1869): save_mod_rewrite_rules()
roots/sage#3 /srv/www/servername/releases/20210416210751/web/wp/wp-includes/class-wp-hook.php(292): WP_Rewrite->flush_rules(true)
roots/sage#4 /srv/www/servername/releases/20210416210751/web/wp/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(NULL, Array)
roots/sage#5 /srv/www/servername/releases/20210416210751/web/wp/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
roots/sage#6 /srv/www/servername/releases/20210416210751/web/wp/wp-settings.php(582): do_action('wp_loaded')
roots/sage#7 /srv/www/servername/releases/20210416210751/web/wp-config.php(9): require_once('/srv/www/servername/r...')
roots/sage#8 /srv/www/servername/releases/20210416210751/web/wp/wp-load.php(42): require_once('/srv/www/servername/r...')
roots/sage#9 /srv/www/servername/releases/20210416210751/web/wp/wp-blog-header.php(13): require_once('/srv/www/servername/r...')
roots/sage#10 /srv/www/servername/releases/20210416210751/web/index.php(6): require('/srv/www/servername/r...')
roots/sage#11 {main}
"} 
andriilive commented 3 years ago

Faced same issue on OpenLightSpeed & Digitalocean

retlehs commented 2 years ago

this no longer seems to be an issue :eyes:

Rvervuurt commented 2 years ago

I've just ran into this/something similar in a new theme. I've moved an older sage 10 theme onto the same server which works without a problem. My error says is_file(): open_basedir restriction in effect.. Checked composer.json and made sure the same package versions (as the older sage 10-theme) were being used when running composer install, but still getting the is_file(): open_basedir restriction in effect.-error.

My solution was to copy the vendor-folder from the working theme into the folder of the not-working theme, after which the not-working theme started working.

I've not been able to pinpoint where the mistake is happening though, so for anyone finding this, try the above. It should also work with a completely "naked" Sage 10 theme, if you can get one of those to work.