1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Including files outside httpdocs folder fails

Discussion in 'Plesk for Linux - 8.x and Older' started by bmatzner, Oct 29, 2007.

  1. bmatzner

    bmatzner Guest

    0
     
    Hi,

    I have a PHP application sitting in my httpdocs folder

    /domain/httpdocs/index.php

    using a require_once pointing to a file outside this folder

    /domain/library/Zend/Controller/Front.php

    The file is there and is set to 644

    I get this error message though.

    Code:
    [Mon Oct 29 12:22:04 2007] [error] [client xxx] PHP Warning:  require_once(Zend/Controller/Front.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /var/www/vhosts/domain/httpdocs/index.php on line 51
    Code:
    [Mon Oct 29 12:22:04 2007] [error] [client xxx] PHP Fatal error:  require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'Zend/Controller/Front.php' (include_path='.:/var/www/vhosts/domain/library:/var/www/vhosts/domain/application/models:/usr/share/php:/usr/share/pear') in /var/www/vhosts/domain/httpdocs/index.php on line 51
    
    I checked permissions, even changed owner and group IDs so to make sure it nothing to do with it.

    I tried adding a vhost.conf file and adding the /var/www/vhosts/domain folder to open_basedir

    Still I get these error messages.

    On other servers, this application works just fine.

    Any hints?

    Thanks,
    Bernd
     
  2. dirty@

    dirty@ Guest

    0
     
    If I am not wrong, if there were permissions or open_basedir problem, then you would see appropriate PHP errors about them... However 'no such file' error means exactly what it means - file cannot be found in specified path(s), try to check what path is used in the script, try to use full path instead of relative and so on..
     
  3. bmatzner

    bmatzner Guest

    0
     
    Hi Dirty,

    the file is definitely there... It's strange, because everything's working properly on my local Apache. It's also working on a Windows IIS, it's just here on this Debian machine with Plesk it doesn't work. It really has to do with the include_path...

    Still wondering,
    Bernd
     
  4. anb_t

    anb_t Guest

    0
     
    Try specifying full path to the file: require_once(/domain/library/Zend/Controller/Front.php) instead of the relative path require_once(Zend/Controller/Front.php).

    ./anb
     
  5. bmatzner

    bmatzner Guest

    0
     
    After much fiddling, I could resolve it by adding a vhost.conf file for the domain and meticulously adding all the necessary folders outside my root to the open basedir list:

    <Directory /var/www/vhosts/domain/httpdocs>
    <IfModule mod_php4.c>
    php_admin_flag engine on
    php_admin_flag safe_mode on
    php_admin_value open_basedir "/tmp:/var/www/vhosts/domain:/var/www/vhosts/domain/httpdocs:/var/www/vhosts/domain/library"
    </IfModule>
    <IfModule mod_php5.c>
    php_admin_flag engine on
    php_admin_flag safe_mode on
    php_admin_value open_basedir "/tmp:/var/www/vhosts/domain:/var/www/vhosts/domain/httpdocs:/var/www/vhosts/domain/library"
    </IfModule>
    Options +Includes -ExecCGI
    </Directory>

    Then reload Apache and I was up and running.

    Bernd
     
Loading...