Per-Domain php.ini settings through GUI (TEMPLATES)(SKINS)

Version 1.61.4

Feature
Finished

Per-User control, for per-domain php.ini settings. Currently only saves the changes to the "DOMAIN CONFIG" listed below (more usage to follow shortly) For "Enhanced" style skins, you'd view the domain's settings at: CMD_PHP_SETTINGS?domain=domain.com ==================== NOTES php-fpm only supporst 1 php-fpm.conf file (one per User) You'll need to set the desired php settings on the "Main Domain" of the account to alter php settings for this User. Other php modes like mod_php+mod_ruid2, or fastcgi support per-domain php settings. ==================== VIEW SETTINGS (JSON) GET: CMD_PHP_SETTINGS?domain=domain.com&json=yes returns JSON list with 2 sub-lists: "domain_php_ini" : containing all php.ini settings, based on the DOMAIN CONFIG below "template_php_ini" : contains the json from the template['ini'] item with info on each php.ini that can be set. The domain_php_ini is a basic php.ini json array without sub-arrays. The template_php_ini has each index as the php.ini name, with the value being an array. Each template php ini item sub-array will have a "type" and "default" value set. See the next section for info on template types. ====================== DISABLE Should you want to disable the User's ability to use this feature, the commands.deny could be used, or use the never commands, eg: /usr/local/directadmin/direcadmin set never_commands CMD_PHP_SETTINGS service directadmin restart ==================== TEMPLATE TYPES "bool": Can be "On" or "Off" (note the upper case first letter). "list": will have a sub-array called "values" being the values which can be chosen from. "value": basic input text. There are some character restrictions done on the back-end. "int": will have a sub-array called "range", which is an integer array with 2 items, the low and the high values. See the TEMPLATE below for more samples. ==================== DOMAIN CONFIG /usr/local/directadmin/data/users/username/domains/domain.com.php.ini In a standard php.ini syntax: name=value ... ==================== ADDING A SETTING Let's say we want to save: max_execution_time=45 To save a change, use: CMD_PHP_SETTINGS method: POST action=add domain=domain.com max_execution_time=45 save_max_execution_time=anytext Where DA only notices which values are to be saved when "save_" is prefixed to the front. For json/API calls, multiple save_max_execution_time type values can be passed in the same post. Enhanced just uses 1 at a time. ==================== DELETE A SETTING CMD_PHP_SETTINGS method: POST action=delete domain=domain.com select0=max_execution_time (select1=max_input_vars) ==================== SKINS Enhanced: /usr/local/directadmin/data/skins/enhanced/user/php_settings.html with a link to CMD_PHP_SETTINGS?domain=domain.com in enhanced/user/modify_domain.html to the right of the PHP on/off checkbox, called "Php Settings" ==================== TEMPLATES virtual_host2*.conf: added: |CLI_PHP_SETTINGS| within the |*if CLI="1"| section. user_virtual_host.conf: added: |CLI_PHP_SETTINGS| within the |*if USER_CLI="1"| section. php-fpm.conf: added |FPM_PHP_SETTINGS| before |CUSTOM2| php-cron.ini: added |CRON_PHP_SETTINGS| at the bottom (php_settings.json and php-cron.ini values must not overlap) openlitespeed_vhost.conf: added |CLI_PHP_SETTINGS| after |CLI_PHP_MAIL_LOG| NEW: /usr/local/directadmin/data/templates/php_settings.json Contents, at the time of this writing: { "ini" : { "allow_url_fopen" : { "default" : "On", "type" : "bool" }, "display_errors" : { "default" : "On", "type" : "bool" }, "error_reporting" : { "default" : "E_ALL & ~E_NOTICE", "type" : "list", "values" : [ "~E_ALL", "E_ALL & ~E_NOTICE", "E_ALL" ] }, "file_uploads" : { "default" : "On", "type" : "bool" }, "include_path" : { "default" : "\".;/path/to/php/pear\"", "type" : "value" }, "log_errors" : { "default" : "Off", "type" : "bool" }, "mail.force_extra_parameters" : { "default" : "", "type" : "value" }, "max_execution_time" : { "default" : 30, "type" : "int", "range" : [ 0, 14400 ] }, "max_input_time" : { "default" : 60, "type": "int", "range" : [ 0, 14400 ] }, "max_input_vars" : { "default" : 1000, "type": "int", "range" : [ 1, 100000 ] }, "memory_limit" : { "default" : "128M", "type" : "list", "values" : [ "64M", "128M", "192M", "256M", "368M", "512M", "768M", "1024M" ] }, "post_max_size" : { "default" : "8M", "type" : "list", "values" : [ "2M", "4M", "8M", "16M", "32M", "64M", "128M" ] }, "register_globals" : { "default" : "Off", "type" : "bool", "require" : { "php_ver" : "<5.4.0" } }, "session.gc_maxliftime" : { "default" : 1440, "type" : "int", "range" : [ 1, 1209600 ] }, "short_open_tag" : { "default" : "On", "type" : "bool" }, "upload_max_filesize" : { "default" : "2M", "type" : "list", "values" : [ "2M", "4M", "8M", "16M", "32M", "64M", "128M", "256M", "512M", "1G" ] }, "zlib.output_compression" : { "default" : "Off", "type" : "bool" } } } ======== EVO1927

Interested to try DirectAdmin? Get a 30-day Free Trial!