Welcome to weblogs.com.pk Sign in | Join | Help

Specifying PHP.INI path

Today I wanted to test a php application behavior in Apache and IIS simultaneously; and for that I wanted to have a single PHP.INI file for both the servers. Apache part was easy; but not the IIS one. IIS was trying to load the ini file from %WINDOWS% folder. So, if you want that PHP.INI file is read from a specified location; you may add the following entry in your registry.

Windows Registry Editor Version 5.00


Make sure; the path should ends with “\”

The other option is to define environment variable PHPRC. How PHP look for PHP.INI is explained at http://www.php.net/configuration

This can be useful; if you are running multiple webservers and you want to have a single ini file for PHP configuration.

Published Saturday, October 8, 2005 3:17 PM by khurram


# re: Specifying PHP.INI path

Monday, October 10, 2005 12:40 AM by kadnan
yes by default it loads from Windows directory but there is no need to go into registery.

I suppose one is not using typical MSI which setsup everything itself but a ZIP package which have EXEs in the root of PHP directory(e.g: PHP5 for php v.5)

-open IIS panel,go to DefauultWebsite->properties->HomeDirectory->Configuration, it will popup a window with a list of registered extensions and their executables.

-Click Add and specify your php.exe path along with -c switch,specify php extension(e.g .php or even .khurram)

your enteries would be something like that

Executable:C:\php5\php-cgi.exe -c C:\php5\php.ini <from v5 and onwards,you are asked to use CGI version of php with IIS

Extension: .php or of your choice,as i said your own name(.khurram),i assume your php will be run by extension .khurram

-create a sample file with extension .khurram and write phpinfo();

thats it




Wednesday, October 12, 2005 10:24 PM by Khurram Aziz
Few days I posted about specifying php.ini path; and Adnan posted a simpler technique to use php.exe...
New Comments to this post are disabled