How to use php_value at place of php_admin_value?

Discussion in 'Installation/Configuration' started by ispconfig_question, Jan 23, 2012.

  1. ispconfig_question

    ispconfig_question New Member

    I'm using ISPconfig 3 for webserver management. I noticed the PHP scripts are unable to set session.save_path and several other ini values. After a little searching I found out it is caused by ISPconfig settings in the vhost Apache configuration file. ISPconfig sets different session.save_path for each website. Up to this point, everything is OK. But ISPconfig uses Apache directive php_admin_value to set the PHP config value, which disallows further changes in .htaccess or runtime. I don't want to limit the scripts in setting their own session.save_path, so settings this by php_value directive (at place of php_admin_value) would be perfect for me.

    Is there any way how to set ISPconfig to use php_value at place of php_admin_value for certain ini settings? If not, what can I expect if I change the .vhost Apache config file generated by ISPconfig? Will it break ISPconfig's ability to set up this website? Or will it get overwritten each time I change anything in ISPconfig for this website?
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    If you use mod_php, then you can set these values in the apache directives field of the website settings, if you use php cgi, fcgi or suphp, then you can use the custom php.ini field. Thats all described in the ISPConfig manual by the way.
  3. ispconfig_question

    ispconfig_question New Member

    Thanks for the answer. I have a slight suspicion it's not an answer to what I was asking (I didn't want the admin to be able to change the settings, but the script itself to be able to change the settings by ini_set), but nevertheless it worked.

    So just for record if someone else searches for the solution of same problem:
    - ISPconfig creates Apache conf file for each website and in this conf file it places php_admin_value to set php config values of open_basedir, session.save_path and several others
    - due use of php_admin_value Apache directive, the user is unable to change these settings in .htaccess or runtime (using ini_set), he must ask admin to change it (which means for example that runtime decision in the script is impossible)
    - you cannot stop ISPconfig from generating conf files this way, however you can add new Apache directive (in ISPconfig Sites section, on a site's Options tab) "php_value session.save_path xxx" (where xxx is the same value as ISPconfig has created)
    - at this point you have a conf file for this website containing
    php_admin_value session.save_path xxx
    php_value session.save_path xxx
    - now php_value takes precedence over php_admin_value and effectively removes the limits imposed by php_admin_value - and you can set session.save_path by ini_set in your php scripts.

    Please note that even though this seems to work (on PHP 5.3.2), I haven't found any documentation about it so this might be changed in next version or even considered a bug (which wouldn't surprise me, as having "weaker" directive php_value to take precedence over "stronger" directive php_admin_value looks a bit strange to me).
  4. ispconfig_question

    ispconfig_question New Member

    In case anybody's interested: the answer to my original question (how to replace php_admin_value by php_value) is /usr/local/ispconfig/server/conf/vhost.conf.master (on CentOS 6, perhaps might be located elsewhere on different distros). This file seems to be a template used by ISPconfig when constructing Apache conf file for each website. I have modified it and it seems to work and to have no unwanted side-effect. This seems to me to be "cleaner" approach than having both php_admin_value and php_value for the same config var in the conf file.
    I hope this information might help somebody. In case I'm wrong about it, please someone correct me.
    Last edited: Jan 24, 2012

Share This Page