• Warning: is_dir(): open_basedir restriction in effect. File(/plugin-templates/login-with-ajax/) is not within the allowed path(s): (/var/www/vhosts/iberdomotica.com/:/tmp/) in /var/www/vhosts/iberdomotica.com/httpdocs/wp-content/plugins/login-with-ajax/login-with-ajax.php on line 693

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Patrick Baldwin

    (@patrelentlesstechnologycom)

    I had this issue as well. It’s making an absolute mess of the PHP error logs.

    The issue is that the 2nd parameter passed to path_join is an absolute value and so the path is never actually being joined onto WP_CONTENT_DIR. Calling is_dir on the absolute path: “/plugin-templates/login-with-ajax” is resulting in the warning because on many hosting providers that path will be outside of the webroot.

    Current code on line 693: $wp_content_folder = path_join( WP_CONTENT_DIR , "/plugin-templates/login-with-ajax/");

    Should be: $wp_content_folder = path_join( WP_CONTENT_DIR , "plugin-templates/login-with-ajax/");

    The only change is removing the leading slash in the 2nd parameter.

    I fixed this manually on our site, but would love to see this included in a patch version so a plugin update won’t clobber our logs again.

    I can confirm @patrelentlesstechnologycom ‘s assessment of the problem: adding an initial slash to /plugin-templates/login-with-ajax/ has the effect that the path_join function sees it as an absolute path.

    Since the WP constant does not include a trailing slash, you would want to use an initial slash if directly joining the WP constant and the trailing portion of the path, like this:

    $wp_content_folder = WP_CONTENT_DIR . "/plugin-templates/login-with-ajax/";

    However, if using the path_join function, the initial slash must NOT be present:

    $wp_content_folder = path_join( WP_CONTENT_DIR , "plugin-templates/login-with-ajax/");

    I also applied a manual fix to avoid errors popping up. Please fix!

    I can confirm that this bug is still relevant, please check the proposed solutions!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘is_dir() error open_basedir restriction’ is closed to new replies.