pear + safe_mode?

Discussion in 'Installation/Configuration' started by Ben, Oct 10, 2006.

  1. Ben

    Ben ISPConfig Developer ISPConfig Developer

    Hi folks,

    got the followin problem, I have an application using pear / excel spreadsheet to create excel files.
    Safe mode is on for the web.
    The first error is that in can not open the pear files because the dir is not in the open_basedir list. If I now add it, that error is gone but because of safe mode we have a uid conflict because the pear stuff is owned by root.
    Sure switching safe_mode off the whole stuff works.
    But I'm looking for a solution that I can use pear with any web (if possible without switching to suphp), that means changing the pear files owner to the web one won't help.
    Any ideas?
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    If i remember correctly, there is a setting in PHP to define a directory that is outside the open_basedir directory for includes. Have you tested this option?

    The other solution is to install a local copy of the pear files for the website, but thats nor really elegant :(
  3. Ben

    Ben ISPConfig Developer ISPConfig Developer

    Hi Till,

    sure, I could just throw it in the include path, but then open_basedir restriction takes effekt due to safe_mode.
    If I add it as well to the open_basedir, I have a safemode restriction because of uid of root (pear files owned by root), vs. apache2 user under which the php script that tries to include the pear stuff... so that's my "real" problem ;)

    Regarding the copy, is it possible to create symlinks having another owner, than the file they link to=
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    I dont meant the normal include setting, I meant the safemode_include_dir (forgot the correct name in the first post :).

    From php.ini:

    But I have not tested this, especially with open_basedir. Maybe it is possible to set this to a local website directory that is symlinked to a global pear directory... :)
  5. Ben

    Ben ISPConfig Developer ISPConfig Developer

    To finish that post for others having the same problem, yes, safe_mode_include_dir helps.

    @Till: Already entered it there but just with some typos in the path :(
  6. Ben

    Ben ISPConfig Developer ISPConfig Developer

    @till: Well it does not really help, because the php.ini settings are overwritten by the vhost.conf settings. Adding it to the httpd additional stuff won't help, because these values are written before the php stuff in the conf though they have no effect.

    Is there a way to change that, to either always allow pear, make the user check "allow pear" or most flexible, an additional box for the admin to add pathes to openbasedir...

    In my case I changed linke 1448 from config.lib.php
    php_admin_value open_basedir \"/usr/src/php/:".$mod->system->server_conf["server_path_httpd_root"]."/"."web".$web["doc_id"]."/\"
  7. falko

    falko Super Moderator ISPConfig Developer

    You could put an .htaccess file in the directory. You might have to enable
    AllowOverride all
    for that directory.

Share This Page