PHP application - Cannot access the system /tmp directory due to open_basedir restriction in effect

  • Moin Nuxwin

    I have a problem with xenforo 2.1 (PHP application). I have to modify the open_basedir because I need add the /tmp path to the list of allowed paths. Right now, I get the following error:


    Code
    1. php_admin_value[open_basedir] = /var/www/virtual/gameserversupport.de/:/opt/phpswitcher/static/php7.2/share/pear/


    My system

    all addons are current

    my System :

    - Distribution: Debian | Release: 9.13 | Codename: wheezy
    - i-MSCP Version: i-MSCP 1.5.3| Build: 20181208 | Codename: Ennio Morricone
    - Plugins installed: ClamAV (v. 1.3.0), Mailgraph (v 1.1.1), OpenDKIM (v 2.0.0), SpamAssassin (v 2.0.1)
    - LetsEncrypt (v3.3.0), PhpSwitcher (v 5.0.5), RoundcubePlugins (v 2.0.2)YubiKeyAuth 1.1.0

  • Speddy

    Changed the title of the thread from “ErrorException: [E_WARNING] tempnam(): open_basedir restriction in effect. File(/tmp)” to “[E_WARNING] tempnam(): open_basedir restriction in effect. File(/tmp) phpswicher”.
  • File(/tmp) is not within the allowed path(s):

    Your application cannot access the /tmp directory which is the expected behavior as customers have their own temporary dir: /var/www/virtual/<customer>/phptmp



    First solution (recommended)


    You need configure your application to use this directory. This is the recommended solution as this avoid the PHP application to acces system temporary directory.


    Second solution (not recommended)


    The second solution is to add the /tmp directory to the list of allowed directories through the open_basedir PHP directive. How to process? Please read the How to share PHP libraries between sites not owned by the same customer thread in which I explain how to modify the default open_basedir directive value through an i-MSCP listener file.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Nuxwin

    Changed the title of the thread from “[E_WARNING] tempnam(): open_basedir restriction in effect. File(/tmp) phpswicher” to “PHP application - Cannot access the system /tmp directory due to open_basedir restriction in effect”.
  • Nuxwin

    Added the Label question (answered)