Support » Plugin: Ultimate Member – User Profile, User Registration, Login & Membership Plugin » Image upload throws open_basedir restriction, wp-load not found

  • Hi,

    Uploading a picture to the ultimate member profile page throws following error:
    Warning: require_once(): open_basedir restriction in effect. File(/srv/wp-load.php) is not within the allowed path(s): (/srv/www/:/tmp) in /srv/www/weisang.com/current/web/app/plugins/ultimate-member/core/lib/upload/um-image-upload.php on line <i>11</i>

    This is because in bedrock wordpress stack the plugin folder is not in the default wp/ folder. Creating a symlink to wp-load.php in the root resolves this error, but it would be better if the path to wp-load is determined with site_url(), or if wp-load is not required at all http://ottopress.com/2010/dont-include-wp-load-please/

    • This topic was modified 4 years, 2 months ago by sdieneudenker.
Viewing 7 replies - 1 through 7 (of 7 total)
  • This is not a UM issue. Ask your host to disable the ‘PHP open_basedir’ protection, or if you can. do it yourself in your cPanel.

    I don’t think it is a problem with the php server. I’m developing on a local vagrant machine and don’t have this issue with anything else. The problem is related to um looking for wp-load in the wrong path. In plugins/ultimate-member/core/lib/upload/um-image-upload.php ultimate member searches for wp-load.php like this:

    
    $i = 0;
    $dirname = dirname( __FILE__ );
    
    do {
    	$dirname = dirname( $dirname );
    	$wp_load = "{$dirname}/wp-load.php";
    }
    while( ++$i < 10 && !file_exists( $wp_load ) );

    But in the bedrock wordpress stack the path to plugin folder is not similar to the path to the wp/ folder, hence is is not possible to find wp-load.php in our case with your approach. It would be possible if you used wordpress function site_url() instead of dirname(), or used a complete different approach as described here: http://ottopress.com/2010/dont-include-wp-load-please/.

    As I stated before creating a symlink to wp-load.php in the dirname path resolved the issue for me, but is not a nice solution

    The problem persists. The plugin is looking in the wrong path for wp-load.php as the plugin is not located inside the wp/ folder. As seen in the code snippet I posted previously the plugin searches in the dirname path for wp-load.php. The path to the plugin is site/web/app/plugins/... but the path to wp-load is site/web/wp/wp-load.php!

    The problem persists. The plugin is looking in the wrong path for wp-load.php as the plugin is not located inside the wp/ folder.

    We’ll, it’s a WordPress “plugin”, mainly to be used on Apache servers running PHP. Am I to understand that you are advocating a change in the script’s path so that it can suit your needs?
    If so, this is the wrong place to do so. You should take it to the UM Gist where the authors can take a look at what you propose and implement new ideas (or not)…

    I don’t think that it is just for my needs. I think it is pretty common to use a different folder structure than the standard. I posted here because on the ultimate member page they referred here for support. But probably you are I right and I have to put the proposal somewhere else.

    You are confusing UM support with UM development help. We deal here with issues like “My profile page is empty” or “Can not upload an avatar” or “how to redirect after login”…I’ve tagged this so Do comeback to link the Gist post to this topic, that is not against rules.

    I hope this helps

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Image upload throws open_basedir restriction, wp-load not found’ is closed to new replies.