Strange permissions/open_base_dir in Wordpress site moved with duplicator plugin

Discussion in 'Tips/Tricks/Mods' started by muelli75, Nov 6, 2022.

  1. muelli75

    muelli75 Member HowtoForge Supporter

    Hi!

    Having here a wordpressinstallation where uploading a file (media) isnt possible. If the customer tries, the following error occurs in Wordpress:
    Code:
    „kalender-2023-oesterreich-querformat-in-farbe.pdf“ konnte nicht hochgeladen werden.
    Das Verzeichnis uploads/2022/11 kann nicht angelegt werden. Ist das übergeordnete Verzeichnis durch den Server beschreibbar?
    So I checked the permissions of /var/www/customerdomain.at/web/wp-content/uploads/2022 and all the directories above, all are correct
    Code:
    drwxr-xr-x 10 web49 client21 4096 Nov  6 06:11 2022
    But looking into /var/www/clients/client21/web49/log/error.log if found
    Code:
    [Sun Nov 06 10:54:27.545572 2022] [proxy_fcgi:error] [pid 304540:tid 139915568645888] [client 213.147.165.66:13550] AH01071: Got error 'PHP message: PHP Warning: 
    file_exists(): open_basedir restriction in effect. File(/var/www/clients/client33/web60/web/wp-content/uploads/2022/11) is not within the allowed path(s):
    (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2034PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect. File(/var/www/clients/client33/web60/web/wp-content/uploads/2022) is not within the allowed path(s):
    (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect.
    File(/var/www/clients/client33/web60/web/wp-content/uploads) is not within the allowed path(s): (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content) in
    /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect. File(/var/www/clients/client33/web60/web/wp-content)
    is not within the allowed path(s): (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect.
    File(/var/www/clients/client33/web60/web) is not within the allowed path(s): (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect.
    File(/var/www/clients/client33/web60) is not within the allowed path(s): (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect.
    File(/var/www/clients/client33) is not within the allowed path(s): (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect.
    File(/var/www/clients) is not within the allowed path(s): (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect.
    File(/var/www) is not within the allowed path(s): (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect.
    File(/var) is not within the allowed path(s): (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045PHP message: PHP Warning:  is_dir(): open_basedir restriction in effect.
    File(/) is not within the allowed path(s): (/var/www/clients/client21/web49/web:/var/www/clients/client21/web49/private:/var/www/clients/client21/web49/tmp:/var/www/customerdomain.at/web:/srv/www/customerdomain.at/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client21/web49/web/wp-content)
    in /var/www/clients/client21/web49/web/wp-includes/functions.php on line 2045', referer: https://www.customerdomain.at/wp-admin/media-new.php
    Lets see, thats in line 2 "client33/web60" - but the client is client21 and web49!

    How is this possible? Any ideas? Thanks for any input.
    Some other installations of wordpress are running without troubles.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Check options tab of this website in ISPConfig website settings to see which user and group this site belongs to. Might be that the website content was copied from another site on the shell or someone changed the permissions on the shell to the wrong user.
     
  3. muelli75

    muelli75 Member HowtoForge Supporter

    On the options-tab I can see
    Code:
    Linux User:    web49
    Linux Group:    client21
    so thats OK.

    The ownership on all files in that /var/www/customerdomain.at/web is web49:client21
    To be sure thats so, I did in /var/www/customerdomain.at/web a
    Code:
    chown web49:client21 * -R
    Tested again, the same permissionfault is given:
    "File(/var/www/clients/client33/web60/web/wp-content/uploads/2022/11) is not within the allowed path(s):"

    Checked if client33/web60 is hardcoded in a wordpress-config-file? Checked "wp-config.php", but I cant find that.

    So I checked the database - i recocnized that the the plugin "duplicator" (which is a movingtool) has some hardcoded entrys in its tables which contained "client33/web60". So I changed that to "client21/web49" - and it worked.

    Thanks @till for guiding to that.
     
    ahrasis, Th0m and till like this.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Thank you for posting the solution. Are you fine with moving the post to the public forum section? I guess it might be useful for other users with the same issue.
     
  5. muelli75

    muelli75 Member HowtoForge Supporter

    Yes, please move to public.
     
  6. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    glad it's all working, but it's unlikely the problem was with hardcoded paths set for the duplicator plugin.. once a site has been copied to the new location, nothing set for duplicator should have any effect on uploading files.
    it's much more likely that the site had previously had the upload_url_path or upload_path (probably the latter) set, and this was now hardcoded in the wp_options table.
    the solution, as you've found, is to just change that to the new client/web id settings. something which i assume you replaced globally in the db, which is why it happened to work, if you only changed these settings as they related to the duplicator plugin, the problem would likely have persisted.
     
    ahrasis likes this.

Share This Page