Install and use PHP for IIS7: WINDOWS 7
I installed Ap开发者_开发技巧ache, PHP and Apache to be used with PHP. The Apache server was never pointing to localhost, and the localhost always pointed to IIS instead of Apache.
Interestingly, I had a seperate website (explicitly named with somename.com, running locally with default port 80 and upon firing the Apache server the site was being used (instead of localhost) for displaying the Apache-based folders.
However, both are not able to process PHP and I've been trying to get this to work for almost a day now (I thought it wouldn't be too rough on me initially)
So since no matter what change I've made:
Apache configuration to use specific IP, rather than port 80. Restricted IIS on specific ports, rather than port 80 and all local ports. Disabled IIS via 'Services' in Administrative Tools. Forced restart of 'Apache Service' via 'Services' in Administrative Tools (this threw an error). But restarting it via the Apache Http server menu options seemed to work fine. Installed XAMPP so it will run directly (not sure if I'm using this wrong though, it did seem to start up but again localhost was never pointing to the Apache's 'htdocs' like it's supposed to.
PHP was added to Apache as well as downloaded (both .MSI, .ZIP installed for BOTH Apache and IIS). No option seems to make the PHP process, it just displays the source code (like in HTML you have the html, head, body tags displayed on the web site instead of actual HTML ). It's pretty frustrating that:
After different attempts to disable IIS, I've not been able to. Apache has everything configured to run PHP (I have actually done this on a Macbook once a long time back, don't remember if I missed anything though) but it doesn't work.
No errors are thrown, except that localhost is not displayed (I stopped the sites that were on IIS, and localhost points to IIS, any attempts at accessing either the IIS specific folders, or the Apache sites are not working).
Also, several attempts of getting PHP to work on WINDOWS 7 (yes in capital letters) has failed as well. Please help!!! Let me know if any specific details may help in troubleshooting, and I will be glad to provide them.
Well, firstly, apache is obviously now running as you can see the php source. If you only see php source, assuming the PHP file is of a .php extension, you can boil it down to almost certainly the mime type hasnt been set.
in your apache config there will be lines such as:
AddType application/x-httpd-php .php
if not, add it.
If that doesnt work it would really seem it hasnt heard of PHP at all. having not got apache on win7 to hand, theres probably a loadmodule line missing, while this is aimed at vista, this may have some ideas.
http://www.wikihow.com/Install-and-Configure-Php-5.2.5-and-Apache-2.2.8-in-Windows-Vista
Just use some prebuilt solution....
I use WAMP, But there are loads out there.
精彩评论