Enable/disable safe_mode in mode Fast-CGI for websites

Discussion in 'Tips/Tricks/Mods' started by HungiTi, Jul 29, 2010.

  1. HungiTi

    HungiTi New Member

    Hi everybody,

    Safemode is not used in ISPConfig 3 as it is marked as deprecated by the PHP developers and will be removed from new php versions, but someone want enable it in old php versions, please follow intructions:

    * Notice: Only used for php mode Fast-CGI.

    1. Run mysql text on dbispconfig database:
    ALTER TABLE `web_domain` ADD `safemode` ENUM( 'Off', 'On' ) NOT NULL DEFAULT 'On' AFTER `suexec` ;
    UPDATE web_domain set safemode='Off';
    2. Add below code after row 170 in file /usr/local/ispconfig/interface/web/sites/form/web_domain.tform.php:
    'safemode' => array (
    'datatype' => 'VARCHAR',
    'formtype' => 'CHECKBOX',
    'default' => 'On',
    'value' => array(=> 'Off',=> 'On')
    3. Add below html after row 73 in file /usr/local/ispconfig/interface/web/sites/templates/web_domain_edit.htm:
    <div class="ctrlHolder">
    <p class="label">Safe Mode</p>
    <div class="multiField">
    {tmpl_var name='safemode'}
    4. Add text below after row 15 in file /usr/local/ispconfig/server/conf/php-fcgi-starter.master:
    -d safe_mode=<tmpl_var name='safemode'> \
    5. Add code below after row 720 in file /usr/local/ispconfig/server/plugins-available/apache2_plugin.inc.php:
    Sample picture

    Finish, test again, good luck.
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Please be aware that you can not install any ispconfig updates after you modified the web_domain table like this. Every future ispconfig udate will fail with a empty database.
  3. HungiTi

    HungiTi New Member

    I agree with you.

    Because I'm using old PHP version (5.2.14) (I upgraded to PHP 5.3.3 but unsuccessful) and want more security, so I prefer to safe_mode on.

    With a similar way, I've added disable_functions (in php mode Fast-CGI) in sites to more security on share hosting, I think add it into default new version ?

    Last edited: Jul 29, 2010
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig 3.0.3 has a function for custom php.ini settings for all php types (cgi,fcgi,suphp and mod_php) which can be used to set values like safemode.
  5. HungiTi

    HungiTi New Member

    I use CentOS 5.5. Would you like tell me more detail about that in ISPConfig 3.0.3 ? It have in ISPConfig 3.2.2 ? Where I can set it ?

    I tested in Apache directives on Sites tab, but unsuccessful. I search on internet and found a method (http://www.howtoforge.com/forums/showpost.php?p=219582&postcount=4). If ispconfig updates, I try to modify the fcgi starter script and master template again ? It will set default in new version ?
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    This is a feature of ISPConfig 3.0.3 and not, so you can not set it in as this feature is not implemented in that version. For details of ISPConfig 3.0.3 Beta 1, please see release nostes in the ispconfig.org blog.
  7. HungiTi

    HungiTi New Member

    Thank you very much. Hope soon release version.
  8. BorderAmigos

    BorderAmigos New Member

    On the current versions can safemode be enabled/disabled via the apache directives on a per site basis?
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    If you use mod_php in that site, then yes. Otherwise, no.

Share This Page