Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: php.ini loading Date: Mon, 13 Jan 2014 15:42:55 +0100 Lines: 57 Message-ID: <52D3FB6F.1090802@arnowelzel.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net EblkiHp5oIG2F2+OpcfmCgFt4vdpM3YFYYjTmAkjqUEOdZMzuS Cancel-Lock: sha1:UyG747KCMCC4oNmQnnBXGTeZDM4= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: Xref: csiph.com comp.lang.php:12647 Am 13.01.2014 04:25, schrieb Scott Johnson: > I am running PHP as an Apache Module. > > PHP 5.2.6 > > On my local server it is loading the php.ini from C:\Windows\php.ini > > I am having 2 issues that I can hope to resolve. > > 1. I would prefer it to load from the working directory which getcwd() > shows to be my site root (as expected). This was never a problem before > but I need to have some independent configs since my clients are across > different servers. This would be a huge security hole! You don't want your php.ini there! > The config text says it will look for it in the working directory which > I think brings me to issue 2. > > 2. The php.ini only reloads when I restart the apache server not on > each page call which I think is why it is loading the default. Yes - because PHP is loaded as Apache module. This means that Apache will only load the PHP module *once* and not for every single request. > When I changed the config on the production server it would reflect it, > but not on the local. > > So in a nut shell I would like to have the config file loaded from my > working directory on each invocation of a php page. Why? 1) You can use ini_set() (see ) to override settings if needed. 2) You can use an .htaccess file to override PHP settings if needed 3) You can use PHP as CGI and not module - so it will be loaded for every request and therefore load the settings as well for every request. I would not recommend this for production sites due to the worse performance compared to the module (which only has to be loaded once when Apache starts) - but for testing purposes this should be OK. 4) You can use PHP with FastCGI using mod_fcgi and an appropriate wrapper script, if you need specific settings for one site where you pass the site specific php.ini to the PHP runtime (and/or customized settings for the site) -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de