[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


PHP4 and PHP5 w/ IIS6.0 and Win Server 2003 (HKEY_LOCAL_MACHINE\...\IniFilePath vs. PATH vs. PHPRC) concurrent installation

Posted on 2004-09-05
Medium Priority
Last Modified: 2013-12-13
My environment:
  Windows Enterprise Server 2003
  MS SQL2000

I would like to create a nice integration development environment in the same machine that supports IIS -> PHP -> (Mysql or MSSQL) in the same server

I've had a very hard time getting PHP4 and PHP5 running concurrently. The closest that I was able to get it was to

Unpack all php 4 into c:\httpd\php4
copy all files from c:\httpd\php4\sapi\* and dll\* into c:httpd\php4 directory (i.e. move up one directory)
Unpack all php 5 into c:\httpd\php5
Set the administration PATH env variable to PATH=...;c:\httpd\php5\;c:\httpd\php4
Go to IIS -> Web Service Extensions - > Add New Extension (1) for PHP pointing to c:\httpd\php4\php4isapi.dll and (2) for PHP5 pointing to c:\httpd\php5\php5isapi.dll
Go to IIS -> Web Sites -> [Properties]  -> Home Directory -> Configuration... -> add mappings .php5 to php5isapi.dll and .php to php5isapi.dll
edit php.ini-recommended on each directory (i.e. php4 and php5) only uncommented several dynamic extensions and, cgi.force_redirect = 0, and extension_dir = "c:\httpd\[php4 | php5]\ext\"
Cold boot

While I can get both php to respond correctly, I cannot see any dynamic extensions loaded.


Under the above arrangement which php.ini is being use for php5? At one point I deleted php.ini and it made no difference.

I have opted to set PHPRC = c:\httpd\php5 which does ready the php.ini and loads my extension correctly. However I break php4. What to do?



Question by:osaez
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 26

Expert Comment

ID: 11987903

Author Comment

ID: 11990931
I did. First, this article is rather old. Secondly, their suggestion is to make one PHP run under ISAPI and another under FastCGI. I'm still confused as to what php.ini is used by the php5isapi.dll if I don't use the registry or the PHPRC. This is the real question.
LVL 40

Accepted Solution

Richard Quadling earned 1000 total points
ID: 12003972
The ini file needs to be called php.ini, even though they come with -recommended and -dist.

Also, php.ini needs to reside in the %windir% directory (C:\WINDOWS, C:\WINNT, or wherever).

I'm not an IIS user (I use Sambar Server http://www.sambar.com). I also only use PHP5.0.1 now.

An assumption.

I would assume that if you were to develop a site, you would use PHP4 OR PHP5. Not both.

If so, the site itself would be the determining factor on whether to use PHP4 or PHP5?

If so, does IIS support a method where you can set the php.ini path in a something like a .htaccess file? I may have all the terminology mixed up here (I don't use .htaccess either!).

I've seen .htaccess used to control PHP's behaviour.

Also, I've just looked through the PHP manual ...

Changing PHP configuration via the Windows registry
When running PHP on Windows, the configuration values can be modified on per-directory basis using the Windows registry. The configuration values are stored in the registry key HKLM\SOFTWARE\PHP\Per Directory Values, in the sub-keys corresponding to the path names. For example, configuration values for the directory c:\inetpub\wwwroot would be stored in the key HKLM\SOFTWARE\PHP\Per Directory Values\c\inetpub\wwwroot. The settings for the directory would be active for any script running from this directory or any subdirectory of it. The values under the key should have the name of PHP configuration directive and the string value. PHP constants in the values would not be parsed.

I'm not sure how useful this will be.

Take a look at ...


The downside here is that it uses CGI rather than ISAPI. So no persistent DB connections.

On one of the pages on this site ...

"Note: with Microsoft IIS, it appears that the php.ini located in the php.exe directory is not taken into account and that PHP seeks it in C:\WinNT. This not existing file, it is the built-in configuration which is taken into account (which is defined within compiled php.exe). This problem does not occur under Apache."

So, maybe drop IIS and go for Apache.



Expert Comment

ID: 12137230
Using Filemon (http://www.sysinternals.com/ntw2k/source/filemon.shtml) you can easily figure out non-standard names for php.ini. For example, in my case (Windows Server 2003, Apache 2.0.50, PHP 5.0.0) in place of  the default "c:\windows\php.ini" I use "c:\Program Files\Apache Group\Apache2\php-apache2handler.ini" and it works perfectly (actually, this location is the first php looks for).

To test which *.ini file can be used, use the Filemon utility and add a filter setting the "Include" option to "*php*ini*" and leaving two other blank. Then start Apache, view any *.php page from your server in browser, and watch the output from the Filemon utility.

You might also want to take look at this:

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question