I want per-domain or per-path settings for php

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » CustomBuild » ./build php

I want per-domain or per-path settings for phpLast Modified: Apr 30, 2016, 5:06 pm
As suPhp is getting old, and doesn't have the performance of newer php types, many Admin's would want to combine the faster methods, while still keeping the ability to have per-item settings to allow custom changes where needed.

If you're using mod_php (cli), the bulk of the php settings can  be set in the Custom Httpd Config with the standard php_admin_flag/php_admin_value settings right in the VirtualHost.

However, you might want even more control, say with a variable that isn't supported in that way, or with a path, rather than a host.
For this case, CustomBuild 2.0 uses a folder for additional php.ini files, loaded if they exist in the folder.
The install path can vary depending on the php mode; in this example, we'll use


but for other php modes, if the php version is , the path might be:


You can determine where you php.ini and php.conf.d folder is by using the Where is my php.ini? guide.

Once you know the path, let's use in our example, you can then create your custom ini file.   The load of the ini files is done alphabetically, so we number the files to control in which order they're loaded in.  Usually the order doesn't matter too much, unless you're altering settings for a module that should be loaded first.

  1. Per-domain settings

    If you would like to create per-domain settings for , you could create:


    and add code like:


    just as an example.
  2. Per-path settings

    Similarly, you can alter settings on a per-path basis, say for User which is handy if you want the settings to apply to a domains under that given path (usually, on a per-User basis), edit the file:


    and set, eg:


In the above examples, it's implying the use of one file for each item you want to separate.  This is not required.  You can use one additional file to make load times faster, but also to hide the list of domains from the phpinfo() output, as all "additional" loaded php.ini files are displayed, so if you were to use:


you could add many [HOST=xx] entries into the same file, one after the other.

Based on: http://php.net/manual/en/ini.sections.php

Related Helpfiles
Adding custom httpd.conf code to the VirtualHosts of a domain
Where is my php.ini?
per-User php.ini settings in php-fpm

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST