• Resolved elleven

    (@elleven)


    Hi,

    for certain reasons I’m using SymLinks in the WP root directory, which refer to log folders outside my webspace. The problem I’m now having is, that BackWPup creates the error message “RuntimeException: SplFileInfo::isDir(): open_basedir restriction in effect” in the log of a backup job and the job is cancelled while BackWPup was creating the file & folder list. The reason for this is quite clear, because of the SymLinks referring are to a location outside the open_basedir. Also this should not (and cannot) be changed due to security reasons.

    The point is: Why is BackWPup treating this as a fatal error and stops progressing? I think if there is a link to any location outside the basedir range, this should not block creating the backup. Just a warning and progressing would be fair enough.

    The funny thing is, that I already excluded these folders before I moved them outside my webspace and replacing them with a SymLink. Now, after having these SymLinks, I also do not see anything in the Files tab of the job settings. I think the PHP for the job settings stops exactly at the same problem.

    Please could you stop treating this as a fatal error and ignore all folders and files, which creates this open_basedir restriction error? I think that would really be the right way to handle such PHP errors.

    Thanks a lot in advance,
    Armin

    • This topic was modified 8 years, 9 months ago by elleven.
    • This topic was modified 8 years, 9 months ago by elleven.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @elleven,
    Could you exclude these folders and then try to run again?
    After that, Do this problem exists?

    Thread Starter elleven

    (@elleven)

    Currently the list of folders is not shown in the config, because that PHP is also stopped due to the same reason. Before I added the SymLinks I had folders with the same name in my WP root folder. I excluded them already. For security reasons I moved them later outside the webspace, where even PHP does not have any access controlled by the open_basedir restrictions. I replaced the folders by the SymLinks pointing to the new location. This is needed, because the ISP is automatically storing the log data there.

    So yes, they are excluded and no, that doesn’t help at all.

    Again, I see this behavior as a SW bug, because backWPup is not handling this error in proper way. Just excluding inaccessable folders or SymLinks by default without generating any fatal error. A warning in the log would be o.k..

    Rgds,
    Armin

    Hi @elleven,
    Thank you, we will talk about this problem with our developers and then get back to you soon!

    @elleven,
    just FYI, the newer version of BackWPUp already has this feature added. So I will mark this problem as resolved! If you’re still having problems, feel free to let us know 😉

    Btw, If you find BackWPUp is useful for you, we would really appreciate if you leave a positive review and rating.
    This would encourage us to develop new free features and provide free support 😀
    https://ww.wp.xz.cn/support/plugin/backwpup/reviews/

    Thread Starter elleven

    (@elleven)

    @duongcuong96,
    I just realized your reply here and tested this in my environment. What now works is that the php of the backend does not crash anymore. But I still have the issue that the backup script crashes, when it tries to create the folder list:

    [26-Dec-2017 12:52:41] WARNUNG: realpath(): open_basedir restriction in effect. File(/www/htdocs/(...)/logs) is not within the allowed path(s): (/www/htdocs/(...)/:/tmp:/usr/bin:/www/htdocs/(...):/bin:/usr/local/bin:/usr/share/php:/dev/urandom)

    [26-Dec-2017 12:52:41] FEHLER: Ausnahme eingefangen in RuntimeException: SplFileInfo::isDir(): open_basedir restriction in effect. File(/www/htdocs/(...)/logs) is not within the allowed path(s): (/www/htdocs/(...)/:/tmp:/usr/bin:/www/htdocs/(...):/bin:/usr/local/bin:/usr/share/php:/dev/urandom)

    I already tried to exclude in different ways, but no success at all.

    Any ideas? I still think the backup script should capture this php error and could create a warning instead of stop at all.

    Rgds,
    Armin

    • This reply was modified 8 years, 5 months ago by elleven.

    @elleven
    This seems like a bug that was not been resolved (yet)
    Please try the following:
    https://ww.wp.xz.cn/support/topic/open_basedir-backup-dir-is-not-within-the-allowed-path/#post-9419849
    Thank you!

    Thread Starter elleven

    (@elleven)

    @duongcuong96:

    No, this does not help. The issue I have is not related to the dir, where the backup should be stored. The issue relates to some symlinks inside my WP installation, which refer to folders outside the open_basedir restriction. I need these links for some security reasons.

    I just made some debugging analysis and found the solution! The difficulty here is that e.g. the isLink() method already tries to access the properties of the target in case of a sym link and an open_basedir exception already occurs. Here is my solution, which I have tested on V3.4.4:

    In class-jobtype-file.php change line 417 to
    if ( $file->isDot() || ! @is_readable( $file->getPathname() )) {

    In class-job.php add the following code after line 1734:

    if ( ! @is_readable( $file->getPathname() )) {
    	$this->log( sprintf( _x( 'File or link "%s" is not readable', 'File or link name', 'backwpup' ), $file->getPathname() ), E_USER_WARNING );
    	continue;
    }

    This now works fine for me.

    Rgds,
    Armin

    • This reply was modified 8 years, 5 months ago by elleven.
Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘open_basedir restriction error in BackWPup when using SymLinks’ is closed to new replies.