Link to home
Start Free TrialLog in
Avatar of smartin0924
smartin0924

asked on

PHP Setup on IIS Server

Experts,

I am a newbie to programming and I have chosen PHP to setup and learn because I have read it is a easier language to pick up and who can beat the price of free.

I have setup a Windows 2003 box running IIS.  I currently have an intranet site where the files are stored on my D: drive and the web page just points to this folder.

What I am needing to know is a how to get the PHP setup started and the correct way to set this up.  

Since my files are on D:

1. Do I need to install PHP on the D: drive as well so it places the PHP folder and php.ini file on D:?

2. Do I move my files from the Intranet folder to the PHP folder?

I am giving the max points on this because I need help getting this going.  I have read several articles but i haven't seen anything address these types of questions.
ASKER CERTIFIED SOLUTION
Avatar of ajarvey
ajarvey
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smartin0924
smartin0924

ASKER

Thanks for replying ajarvey,

Do I choose IIS ISAPI module or IIS CGI?  Also, what are the extensions it ask for ie; Activescript, ADT, APD,APC, bcompiler...

Do i need to install any of these?
I personally would choose the CGI installation, as the ISAPI version can be somewhat cumbersome to get working properly. The only time I reccomend setting up the ISAPI version is if you have a very high traffic site which relies heavily on PHP. The ISAPI version scales better than the CGI version. As far as the other options, the defaults should work just fine. No need to install something if you're not going to utilize it.
OK, I finished the install and created a php file but it will not display.  I created a test file:
<? php

phpinfo();

?>

I saved it to my D:\Intranet but nothing happened.  It tells me the file can not be displayed.  I installed PHP on the C: drive and I added the index.php extension to the Documents tab under the properties of the Webpage.

I also modified the php.ini file to look like this:

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
;
; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues.  The alternate is to use the
; cgi.force_redirect configuration below
doc_root = "D:\Intranet"<--------------------------------------------------------------------This is what I modified---------------------------------------------------

; The directory under which PHP opens the script using /~username used only
; if nonempty.
user_dir =

; Directory in which the loadable extensions (modules) reside.
extension_dir ="C:\Program Files\PHP\ext"

; Whether or not to enable the dl() function.  The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
enable_dl = On

; cgi.force_redirect is necessary to provide security running PHP as a CGI under
; most web servers.  Left undefined, PHP turns this on by default.  You can
; turn it off here AT YOUR OWN RISK
; **You CAN safely turn this off for IIS, in fact, you MUST.**

What is actually displayed in the browser? Is it a 404 error, or something else?
No, it comes back telling me that the page can not be found.  The file is in the root directory of D:\Intranet\helloworld.php.   Here is the path on the web server:  http://intranet.hct.local/helloworld.php
How can I tell if PHP is running?  Will it show up as a service?

Now the folder that is under C:\Program Files\PHP there are 2 exe files in there.  Do I need to do anything with these?
OK, I'm getting something different now.  I removed PHP and reinstalled it to C:\PHP  I read in the manual that says installing it to C:\Program Files\PHP can cause an error.   I also made a copy of my last php.ini file and moved it to the new directory under c:php.

Here is what Im getting now.

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

thank you.
OK, we got it working.    I am able to display the info.php page and I created the infamous "Hello World".  Thanks ajarvey.
Just to make an addittional comment for anyone else who may reference this, when I copied my first php.ini file to the new install directory, it had several errors because alot of the paths to the extensions installed were pointing to the old installation path. C:\Program Files\PHP  instead of C:\PHP.  In order to get my original back, I had to uninstall and reinstall PHP again and then I modified  this one.  So lesson learn on my part.

Thanks Again ajarvey.