PHP open_basedir option problem

Discussion in 'ISPConfig 3 Priority Support' started by tilman, Jul 11, 2023.

  1. tilman

    tilman Member HowtoForge Supporter

    Hi,
    I am running a Typo3 V12 installation on a specific website and Typo3 throws errors from time to time, that some folders are not accessible due to open_basedir restrictions (here folder /_assets):
    Core: Error handler (BE): PHP Warning: file_exists(): open_basedir restriction in effect. File(/_assets/97b9f81619b0ae3fe3ae2f269878f49e/Backend/Css/Backend.css) is not within the allowed path(s): (/usr/share/php:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client1/web2/web:/var/www/clients/client1/web2/tmp:/var/www/clients/client1/web2/web/_assets) in /var/www/clients/client1/web2/web/t3v12/vendor/typo3/cms-core/Classes/Utility/GeneralUtility.php line 215

    The document root is set to:
    DocumentRoot "{DOCROOT_CLIENT}/t3v12/public/"

    ISPConfig Version: 3.2.10p1

    Any help is highly appreciated.

    Thks in advance
    Tilman
     
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Are you installing Typo3 as shell user created for that website? Is it a chroot shell? Did you do cd to directory t3v12/public/ when installing?
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    There must be something wrong in your typo3 settings and not the server settings when Typo3 tries to open files in the system root folder /..... and not inside the website or website root folder /var/www/clients/client1/web2/......
    So the OpenBasedir error must be thrown here as Typo3 tries to access a path that it should not use.
     
  4. tilman

    tilman Member HowtoForge Supporter

    It is a jailkit chroot env and Typo3 was installed in Folder t3v12 using composer.
    Folder public was generated during installation process.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    If PHP is chrooted, then you can probably just disable open basedir by replacing the paths in the open_basedir field of the options tab with the word 'none'
     
  6. tilman

    tilman Member HowtoForge Supporter

    Not really sure, but from my POV, Folder /_assets is below the doc root folder, which has been stripped when raising the error message.
     
  7. tilman

    tilman Member HowtoForge Supporter

    Won´t this raise a security issue?
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    PHP does normally not strip paths in such error messages, so Typo3 tried to open /_assets, which would be the systems root folder / in a non-jailed environment and it would be /var/www/clients/client1/web2/ in the jail. Only for a URL, the folder / would be the the document root as specified in the web server, but this can not be a URL as a URL would not throw a open_basedir error, so this must be a filesystem path.

    It's better to have it in place, but if PHP is jailed, it is locked into the website anyway. What you can try is to add /_assets at the end of the open_basedir, separated by : from the other paths. maybe Typo3 just tries to open that path just to find out that it does not exist or you'll get a better error message then to pin down why it tries to open this wrong path.
     
  9. tilman

    tilman Member HowtoForge Supporter

    Ok, thks. for clarification. I´ll give the "none" option a try.
     
  10. tilman

    tilman Member HowtoForge Supporter

    Ok, just saw, that PHP-FPM is NOT chrooted. So, let´s come back on the original issue.
    Any further help is highly appreciated. Thks.
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, in this case, your problem is that typo3 Tries to open a path that it should not try to open and that PHP open_basedir blocked it is right. Maybe a path variable used in the theme or something similar is empty, because a path like "/_assets/97b9f81619b0ae3fe3ae2f269878f49e/Backend/Css/Backend.css" really looks as if there is a path missing in front of the /. Or Typo3 tries to automatically guess the path and and this somehow fails because it does not get the value it expects e.g. from PHP $_SERVER array or something like this.
     

Share This Page