Forum Moderators: coopster

Message Too Old, No Replies

PHP on IIS and Apache

have current configuration for both but only run one at a time

         

dmcdivitt

7:39 pm on Oct 17, 2008 (gmt 0)

10+ Year Member



I need to configure PHP for both IIS and Apache, and have both configurations present at the same time. I only have one or the other running, but when I turn one off and the other on I need PHP to be working. I used the msi file to install PHP and did not do manual configuration. To change which server, I use control panel, add/remove programs, and change PHP. In the change screen I select what server.

I can set one up automatically then manually do the other, but I can't get it to work. There must be a file I'm not updating. Please help. Thanks

coopster

9:16 pm on Oct 20, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, dmcdivitt.

I wouldn't think you would have to add/remove programs for this to work. I would approach this from a Windows Services angle -- set Apache and IIS both to "Manual" start and then you can fire up whichever service you intend to test against.

dmcdivitt

1:24 pm on Oct 21, 2008 (gmt 0)

10+ Year Member



Thanks coopster. The problem is not which server is running. The problem is PHP can only be configured for one or the other at a time. If I configure PHP for IIS, it won't work with Apache, even if I edit httpd.conf manually. If PHP is configured for Apache then it won't work with IIS. This is why I have to change PHP through the Windows control panel.

Maybe PHP.ini needs to be changed, too. I don't know. I want to set PHP to run on IIS through the control panel, then make a manual change so it will work on Apache. That involves editing httpd.conf.

I guess I can configure for one, save PHP.ini, configure for the other, then see what's different. When swiching server I will then have to make that change.

coopster

3:43 pm on Oct 21, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm fairly certain IIS does not read httpd.conf, the Apache configuration file. And I'm also fairly certain Apache does not care how you have IIS configured. As long as both services are not running at the same time, you should be OK. You actually can run both services at the same time if you would like, as long as they are listening for HTTP traffic on different ports. At least, that is what most IIS users say. I personally haven't used IIS for years now. Here nor there, the configuration for each server is independent of the other.

The php.ini file is the key then. As long as you have php.ini configured correctly, each server will use it as it needs. According to the installation page for IIS [php.net], I don't see any php.ini directives that are going to require updates when you switch between servers. That's the beauty of a configuration file.

Anyango

4:03 pm on Oct 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In the worst case scenario i would simply install PHP in two different folders and configure one for IIS and one for Apache. But there can be better solutions.
What are the changes that you are having to make ?

[edited by: Anyango at 4:04 pm (utc) on Oct. 21, 2008]

dmcdivitt

4:33 pm on Oct 21, 2008 (gmt 0)

10+ Year Member



I saved PHP.ini, then reconfigured PHP for the other server through control panel. I then compared PHI.ini and there was no difference.

If I auto configure for IIS, then go into httpd.conf and add PHP information for Apache, PHP should then work for Apache. This should not be too hard. I've tried it the other way, too. I've auto configured for Apache then does the IIS manual instructions.