Page 1 of 1

Support for project-specific PHP ini locations

PostPosted: March 13th, 2017, 9:52 am
by alex
Hi,

I'm looking into configuring the php.ini location in a project-specific manner.
We have a small team all using PHPtools but when we change PHP ini parameters it's always a pain to get everyone updated with the new ini file.
Since our php.ini file for dev environment is checked in without our source code, it would be a lot easier if we could configure PHPTools to use this ini file instead of the one under C:\Program files\...

Right now we're using IIS Express and PHP 5.6 (moving to 7.0).
It seems PHPTools generates an application.config in the Documents folder of the current user.
In that config the PHPRC envrionment variable is defined as follows:
Code: Select all
<fastCgi>
            <application fullPath="C:\Program Files (x86)\IIS Express\PHP\v5.6\php-cgi.exe" monitorChangesTo="C:\Program Files (x86)\IIS Express\PHP\v5.6\php.ini" activityTimeout="600" requestTimeout="600" instanceMaxRequests="10000">
                <environmentVariables>
                    <environmentVariable name="PHPRC" value="C:\Program Files (x86)\IIS Express\PHP\v5.6\" />
                    <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
                </environmentVariables>
            </application>
            <application fullPath="C:\Program Files (x86)\IIS Express\PHP\v7.0\php-cgi.exe" monitorChangesTo="C:\Program Files (x86)\IIS Express\PHP\v7.0\php.ini" activityTimeout="600" requestTimeout="600" instanceMaxRequests="10000">
                <environmentVariables>
                    <environmentVariable name="PHPRC" value="C:\Program Files (x86)\IIS Express\PHP\v7.0\" />
                    <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
                </environmentVariables>
            </application>
        </fastCgi>


If I change the PHPRC value to my local workspaces php.ini location, this seems to work fine.
However, this local workspace will have another name on my colleagues workstations. Also this application.config file is not part of the project, so changing it will not automatically update my colleagues configurations.

So I think to really get this to work, we need some kind of support for this from the PHPTools plugin.
Is this something that can be investigated?

Re: Support for project-specific PHP ini locations

PostPosted: March 15th, 2017, 12:26 pm
by Jakub Misek
Hi Alex,

Sorry for the delay.

For such cases, it is recommended to put shared and source controlled INI directives in special `.user.ini` file in root of your web (see attachement).

This functionality is described at http://php.net/manual/en/configuration. ... r-user.php

In this way, when running using IIS/IIS Express, PHP automatically gets additional INI directives from `.user.ini` file and developers can keep it in sync and source controlled.

I hope it helps, Please let me know if it works for you.

Thanks,
Jakub