Re: [ PHP ] Best config practices

Nicholas Calugar

You may also want to look into [1] .user.ini files.


Would you consider compiling PHP with this option:

--with-config-file-scan-dir /home/vcap/app/php/etc/php.d

And then providing some mechanism for the buildpack to copy .ini files from
a known location into that directory?

Nicholas Calugar

On January 20, 2017 at 5:36:45 AM, Daniel Mikusa (dmikusa(a) wrote:

You can include a `.profile.d/` script or a `.profile` script. It depends
on exactly what you're trying to do as to which one would be better to use,
but I believe most of the time you'd want the `.profile` script. You can
see more about it in the docs here.

You can essentially do whatever you want in this script. Plus you'll have
access to everything that the PHP build pack has configured for you and
you'll have access to all the environment variables. This means you can
run PHP scripts or examine VCAP_SERVICES. The only catch is that these
scripts runs prior to your application starting so they must run and your
application must start within the defined timeout (default 60s, max 180s on
most platforms).

If you want to integrate with the build pack and do something during
staging or if you need more time (cause staging typically runs for up to
900s), you can add a build pack extension. These are written in Python and
run as a part of the build pack. Instructions on doing that can be found

Hope that helps!


On Thu, Jan 19, 2017 at 4:01 PM, Leandro David Cacciagioni <
leandro.21.2008(a)> wrote:

I have a php monolith app that requires tons of .ini files config previous
to the deployment I want to know if any of you have a "best practice" to
generate all this ini files depending from the environmental variables.

Join { to automatically receive all group messages.