PHP require - problem with relative path

Discussion in 'ISPConfig 3 Priority Support' started by SupuS, Jan 10, 2017.

  1. SupuS

    SupuS Member HowtoForge Supporter


    after ISPConfig moving from Debian 6 to Debian 7 we have problem with loading files with using PHP require, require_once and include. Script doesn't load file from current directory but search in system paths instead. Here is example warning:

    PHP Warning: require_once(): open_basedir restriction in effect. File(/opt/php-5.4.45/lib/php/PEAR.php) is not within the allowed path(s): (/var/www/clients/client1/web1/web:/var/www/clients/client1/web1/private:/var/www/clients/client1/web1/tmp:/var/www/domain.told/web:/srv/www/domain.told/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web1/web/classes/serializer.php:53
    on the line 53 is:
    require_once 'PEAR.php';
    File PEAR.php is preseneted with same directory as serializer.php. If I use absolute path it works well. How to make it works again? Is there some PHP variable which should I set?

    Configuration: ISPConfig, Debian Jessie, PHP-FPM as additional PHP
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Please check the php.ini file of the php-5.4.45 version, maybe it's include lines does not contain ./ as path.
  3. SupuS

    SupuS Member HowtoForge Supporter

    Hi Till,
    if you mean include_path it contains ".". I tried add "./" too but problem was not solved. Here is include_path of additional PHP:
    /opt/php-5.4.45/bin/php -i |grep include_path
    include_path => .:/opt/php-5.4.45/lib/php => .:/opt/php-5.4.45/lib/php
    Here is system php which works as expected:
    php -i |grep include_path
    include_path => .:/usr/share/php:/usr/share/pear => .:/usr/share/php:/usr/share/pear
    any idea please?
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes, I meant that the '.' is present in the include path, so that's not the problem. Maybe you should consider to add /opt/php-5.4.45/lib/php/ to the open basedir path of this website so that it can use the gloabl pear file.

Share This Page