is_dir(): open_basedir restriction in effect. File(/var/www/clients/client1/web1/web/html/../test) i

Discussion in 'Installation/Configuration' started by ptidav, Jun 4, 2024.

  1. ptidav

    ptidav New Member

    Hello, I'm trying to add a path in open_basedir field for a website but the added value is not taken in account....

    I add it in the related field in website parameters, in options tab
    upload_2024-6-4_10-17-4.png
    The values are :
    /var/www/clients/client1/web1/web:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/octopusbusiness.fr/web:/srv/www/octopusbusiness.fr/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom:/var/www/clients/client1/web1/web/test

    This is the result when I execute a script trying to access /var/www/clients/client1/web1/web/test from a browser :

    is_dir(): open_basedir restriction in effect. File(/var/www/clients/client1/web1/web/html/../test) is not within the allowed path(s): (/var/www/clients/client1/web1/web/html:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/backoffice.octopusbusiness.fr/web/html:/srv/www/backoffice.octopusbusiness.fr/web/html:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom)

    It works fine if I set the path ../../tmp in my script

    I tried to resync all services with no luck...

    Thanks for your help
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Which PHP mode do you use? Are there still pending changes (blinking red dot) in the upper navigation?
     
  3. ptidav

    ptidav New Member

    PHP-FPM
    no red dot
     
  4. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Please turn on debug logging level for that server and if possible run the cron manually.
    It could be something else that's wrong making ispconfig not apply these changes.
    I assume the screenshot shows the text field after you manually entered the additional path and it is gone after saving?
     
  5. ptidav

    ptidav New Member

    I enabled debug and ran the script again but there is no more informations displayed. I get the same error.
    Also, the additionnal path is correctly recorded and right displayed when you open the options tab.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Check if the correct open_basedir path is set the php-fpm pool file for the used PHP version and website. The pool files are typically in e.g. /etc/php/8.3/fpm/pool.d/ The file name contains the ID of the website.
     
  7. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Code:
    cat << 'EOF' > verify_pool_master.sh
    #!/bin/bash
    
    POOL_NAME=$1
    
    if [ -z "$POOL_NAME" ]; then
      echo "Usage: $0 <pool_name>"
      exit 1
    fi
    
    # Get all master processes
    MASTER_PROCESSES=$(ps -aux | grep 'php-fpm: master process' | grep -v grep)
    
    # Get all worker processes for the specified pool
    WORKER_PROCESSES=$(ps -e -o pid,ppid,cmd | grep "php-fpm: pool $POOL_NAME" | grep -v grep)
    
    if [ -z "$WORKER_PROCESSES" ]; then
      echo "No workers found for pool: $POOL_NAME"
      exit 1
    fi
    
    echo "Master Processes:"
    echo "$MASTER_PROCESSES"
    echo ""
    echo "Worker Processes for pool '$POOL_NAME':"
    echo "$WORKER_PROCESSES"
    echo ""
    
    # Check which master process is running the pool
    while read -r WORKER_LINE; do
      WORKER_PID=$(echo "$WORKER_LINE" | awk '{print $1}')
      WORKER_PPID=$(echo "$WORKER_LINE" | awk '{print $2}')
    
      MASTER_LINE=$(echo "$MASTER_PROCESSES" | grep " $WORKER_PPID ")
      if [ -n "$MASTER_LINE" ]; then
        echo "Worker PID $WORKER_PID is run by Master PID $WORKER_PPID"
        echo "Master Process: $MASTER_LINE"
      fi
    done <<< "$WORKER_PROCESSES"
    
    EOF
    Code:
    chmod +x ./verify_pool_master.sh
    ./verify_pool_master.sh web1
    
    just to be sure it is running the expected php-version and there has been no hick up changing different php versions or something like that? Those can happen when having not the correct settings for additional php-fpm versions for example.
    Also after you identified the current running pool, try to restart it
    if it disappears => restart the desired php-fpm pool service
    and go to additional php settings setup and check for issues
     
  8. ptidav

    ptidav New Member

    Sorry guys, I forgot to precise a "little" detail : the site is subdomain declared in "sub-domain (Vhost).
    It was thanks to checking the pool that I realized this...
    So I added the path in the sub-domain Vhost section and it worked !
    Sorry again and thank you very much for your help.
     
    till and ztk.me like this.

Share This Page