WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] PHP warning: require_once ... failed to open stream (17 posts)

  1. not2bug
    Member
    Posted 4 years ago #

    Hello,

    I have the latest version of WordPress running and I´m getting the following error message:

    Warning: require_once(/hsphere/local/home/user/domain.net/wordpress//hsphere/local/home/user/domain.net/wordpress/wp-settings.php): failed to open stream: No such file or directory in /hsphere/local/home/user/domain.net/wordpress/wp-config.php on line 76

    It seems to me that I have to change the latter location to the same one without /wp-config.php.

    Where do I do that?

    Thanks!

  2. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    It looks like you have some sort of domain/path issue on the server.

    (/hsphere/local/home/user/domain.net/wordpress//hsphere/local/home/user/domain.net/wordpress/wp-settings.php)

    The path is being repeated in that error message.

  3. not2bug
    Member
    Posted 4 years ago #

    Thanks for your help.

    Does that mean my best bet is to reinstall WP?

  4. not2bug
    Member
    Posted 4 years ago #

    Just reinstalled WP. Same issue. Any ideas?

  5. not2bug
    Member
    Posted 4 years ago #

    I changed wp-config.php back from

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . '/hsphere/local/home/user/domain.net/wordpress/wp-settings.php');

    to

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . '/wp-settings.php');

    and the page is running again. The original change was by suggestion of my hosting service.

    However, now I´m getting the following error when visting the Settings>Permalinks page, which is what made me contact my hosting service in the first place:

    Warning: is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/hsphere/local/home/user:/tmp:/var/tmp:/usr/local/lib/php:/usr/bin) in /hsphere/local/home/user/domain.net/wordpress/wp-admin/options-permalink.php on line 113 Warning: is_writable(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/hsphere/local/home/user:/tmp:/var/tmp:/usr/local/lib/php:/usr/bin) in /hsphere/local/home/user/domain.net/wordpress/wp-admin/includes/misc.php on line 130

    They just said:

    The settings simply are incorrect. WordPress is trying to access /, which is not expected to have access. You've missed a configuration step somewhere, as it's attempting to write to /; it'd certainly seem a blank value was given.

    What could be missing?

    Thanks, folks!

  6. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    Have you spoken to your hosting provider? The second path:

    No such file or directory in /hsphere/local/home/user/domain.net/wordpress/wp-config.php on line 76

    looks OK but I've not seen anything like the first one before - which make me wonder if there's something wrong with the server's configuration. Try sending them a copy of the error message and ask if they can explain the replication in the first path. I think that's part of the reason why you now have a problem.

  7. not2bug
    Member
    Posted 4 years ago #

    Yes, I've talked to the hosting provider.

    I first contacted them because of the

    Warning: is_writable(): open_basedir restriction in effect.

    error message. They said:

    File(/) is not within the allowed path

    You seem to be trying to access the root of the webserver. Have you properly filled out the configurations required? It's not looking for any file, but rather the root of the webserver, which will not be readable.

    And then:

    The settings simply are incorrect. WordPress is trying to access /, which is not expected to have access. You've missed a configuration step somewhere, as it's attempting to write to /; it'd certainly seem a blank value was given.

    The next email was this:

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH .
    '/hsphere/local/home/user/domain.net/wordpress/wp-settings.php');

    This requires an absolute path; you'd left it (or specified) just with "wp-settings.php" so it attempted to access /wp-settings.php which naturally does not exist.

    Any luck now?

    That's when the first error message popped up. I changed the ABSPATH back to the original and now I'm back at step one.

    The provider seems to think it's an installation issue and suggest I reinstall WP, which I did to no effect.

  8. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    The settings simply are incorrect.

    Not so. It's a server config issue.

    http://www.php.net/manual/en/features.safe-mode.php#ini.open-basedir

    Try the solution in http://wordpress.org/support/topic/187550?replies=2

    Also, if you can log into Admin, check that the upload path in Settings/Misc is correct.

  9. not2bug
    Member
    Posted 4 years ago #

    The solution didn't work, unfortunately. I also checked the upload path and it is correct.

    I'll get in touch with tech support again and show them your post and the links, maybe they can solve the problem this time.

    Thank you for your help. I'll post back with the outcome.

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    First, this line:
    require_once(ABSPATH . '/wp-settings.php');

    Should not be changed. Your host has no idea what they're talking about there, so stop listening to them. The value of ABSPATH is automatically determined and it handles that path for you.

    Second, what do you have as the two URLs on the Settings->General screen? Are they the same, or different? What *exactly* are they set to? DO NOT CHANGE THEM, just tell us what they are.

    My suspicion: You have one of them set to "http://example.com/wordpress" and the other set to "http://example.com/wordpress/". Note the trailing slash of a difference? That slash should not be there.

  11. not2bug
    Member
    Posted 4 years ago #

    The WordPress address is: "http://domain.net/wordpress" (This is where I installed WordPress - it's not in the root)

    The Blog address is: "http://www.domain.net"

  12. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    That's the problem. It is not expected for those variables to have different domain names.

    Change it so that they both have the same domain name. domain.net or http://www.domain.net. Pick one, stick with it.

  13. not2bug
    Member
    Posted 4 years ago #

    Fantastic, that worked! Thank you very much.

    Just a quick follow-up question: now visiting "www.domain.net" takes me to "domain.net", despite having

    RewriteEngine on
    RewriteRule ^domain.net$ www.domain.net

    in .htaccess.

    Any way around that or is it just a necessary compromise?

  14. not2bug
    Member
    Posted 4 years ago #

    Solution found, just change the settings to have both with www. I didn't realize that having www included or not in the WordPress address doesn't make a difference.

    Thank you very much to all who took time to troubleshoot. It's much appreciated.

  15. Samuel Wood (Otto)
    Tech Ninja
    Posted 4 years ago #

    Also, you don't need the RewriteRule for that www vs. non-www thing. WordPress enforces the URL you put into those two fields. It will automatically redirect to the right place.

  16. not2bug
    Member
    Posted 4 years ago #

    Good to know, thank you.

  17. frixory
    Member
    Posted 3 years ago #

    Otto42 wrote "Second, what do you have as the two URLs on the Settings->General screen? Are they the same, or different? What *exactly* are they set to? DO NOT CHANGE THEM, just tell us what they are."

    Where is settings-general screen?

    I think this will solve the same problem I'm having.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags