Sunday, October 08, 2006

php on IIS 6

PHP is a really cool server side scripting interface with loads of options and modules and is relatively easier than ASP (the only other server side scripting language I've used). IIS 6 is also a cool web server with loads of new options. So here is how you configure php on IIS:
(I'm assuming IIS is already installed on your box)

1. Download php from this location
2. Unzip the package to some location(c:\php or whatever)
3. Copy the php.ini-recommended file to your %systemroot% directory(usually C:\Windows) or to the %PHPRC% location, if %PHPRC% variable is set.
4. Rename the file as php.ini
5. Edit the file to make your config. I usually do the following(only minimal stuff):
a. Open short tags ("" should work for me, I'm too lazy)
b. Edit my extension_dir to the right location("c:\php\ext\" or whatever)** DO NOT FORGET TO PUT THE TRAILING BACKSLASH.**
c. Enable my extensions...like php_ldap etc...
d. other stuff...error handling, session mgmt etc etc....please read the docs. :-)
6. Open your IIS snap-in (inetmgr in "Run")
7. Create your website/virtual directory.
8. Enable php on the entire website or your virtual directory:
a. Go to the directory tab, click configuration, click Add.
b. Put in ".php" (without the quotes) in the extension box.
c. Point the Executable file to "php5isapi.dll" (in your php directory)
d. Give your verbs(usually GET,HEAD,POST,TRACE would do)
e. Ensure "Check that file exists" is checked. (saves time and resources)
9. Only for IIS 6:
a. Click on "Web Service Extensions".
b. Click "Add new web service extension"
c. Give some name and add the php5isapi.dll file and select allow.
10. Add the php directory to your path(sysdm.cpl in "Run",Environment Variables under the Advanced tab, under "System Variables", edit the Path variable and append the path to your php directory to it(like C:\php where C:\php is the location of your php source).
11. Restart IIS and enjoy.

Update(thanks to 'anonymous' :-): One important point I forgot to mention - You need to give the user IIS is running as (usually IUSR_MACHINENAME) permissions on your php directory and files, other wise you will end up with 403 or 404 errors.

I've seen on a lot of posts where people mention that they need to copy some files to system32 directory, and I do not think that its required. Here is a filemon snapshot of the location my IIS is finding the extensions:



Each time you make any changes to the php.ini file, you need to restart your webserver.

UPDATE: If you get a prompt for username and password in Firefox even though you enabled just anonymous access, you need to enable the following:
a. In your Firefox window,type in 'about:config' without the quotes
b. You will find a text box called Filter, type in 'auth' without the quotes
c. You'll find an entry called network-automatic-ntlm-auth.trusted-uris
d. Double-click on it. It will open a small input window.
e. Enter the name of the website (usually if you're having issues with http://localhost), enter localhost and click OK. (You can enter multiple sites by separating them with commas)

214 comments:

«Oldest   ‹Older   1 – 200 of 214   Newer›   Newest»
Anonymous said...

I followed the instructions. Well...the ones that were specific enough anyway...but still no PHP. Might this be because I'm using IIS v5.1? TIA for the info.

cipherskull said...

That should not really matter. So are you getting 500 errors /404 errors? Is IIS configured properly(is the web server running properly?)

~cS

Anonymous said...

Can you clarify #10.
Where am I adding this path?
"Add the php directory and to your path."
Thanks

cipherskull said...

You need to add your php directory location to the system path. I've modified #10 to make it a bit more helpful...

~cS

Anonymous said...

modify #10 again so we new peoples can actually understand it... i am not new to computers and what you have here is alien to me... i understand system paths and system variables but you are not specifying if these are relevant to the computer os itself or something else... be specific, please

Anonymous said...

followed the instructions here and on other sites to the letter and when testing php, get a blank page in IE... any help/info would be appreciated (and yes the webserver works as does asp and perl, just not php)

cipherskull said...

a blank page usually means that there is something wrong with the php script itself....

Can you test your php install by creating a php file(test.php) with just the following:

<?
phpinfo();
?>

Ideally it should show your php's config. Another way to isolate issues with php is by going to a commmand prompt and executing the php file as:
C:\php>php test.php
It should output some valid html code...if it does not then there's something wrong with the php install and if it does output properly, then there could be a php configuration issue with your web server....

Also, (just in case), each time we modify something related to php(be it php.ini or anything else) its good to restart the web server(or atleast reload the config)

hope this helps....

Anonymous said...

Thanks for the response, tried the
phpinfo() returned a blank page as the script did. my script is simple, three lines to show that php is working... of course, it isnt...

will try the command line this afternoon, thanks for the help...

Ghowriter

Anonymous said...

Hi CS,

First, thanks for this info! It's been the most helpful I've found thus far.

Trying to enable PHP 5.2.0 on WindowsXP pro IIS 5.1. Having similar problems as other have described.

Specifically, I am able to read from the MySQL database, but database 'writes' are failing. I ran the phpinfo() as you suggested and got back the 5.2 version and detailed info. The only thing that struck me was the PHP ini path was set to c:\program files\php\php.ini instead of to the windows directory, but they are the same anyways so I didn't worry about it.

I feel like it's some sort of permissions issue (e.g. NTFS permissions), but just to test I added the IIS user to the Administrators group, restarted, same thing. I'm also not trapping any errors in the log.

I'm really stumped. Any ideas or suggestions would be GREATLY appreciated. Thanks!

Cheers,
Bill G

Anonymous said...

Can you explain step 5a please.Open short tags where? Inside PHP.ini file? and where should I type it?And step 5b..should that path be right after the = sign (Extension_dir = )inside the quotatioin marks? I would really appreciate your reply.

cipherskull said...

So if you read through the php.ini file, one of the directives would be to "short_open_tag = Off". If you set it to "On", you can enclose your php script within "<? ?>" instead of the regular "<?php" tags.....but please read the note just above this directive... :-)

yes thats exactly how it should be...example: extension_dir = "C:\php\ext\"

Rodrigo said...

I have a win server 2003 R2, with IIS 6.

It work perfectly just following your instructions (i installed PHP 5.2.0)

Thanks a lot.

Rodrigo

Jennifer said...

Can you help with step:
7. Create your website/virtual directory.

I installed IIS on my Windows XP system, and finished step 6, but am now lost as to how to continue.

Thanks!

Anonymous said...

Im on win2003 server/iis6
I always get 404 error when trying to open ANY PHP page. All other extensions are working.
What can it be?

John


www.spamfree24.org

cipherskull said...

In your IIS configuration on your w2k3 server, you need to ensure that you have added a web service extension and also ensure that you have enabled php in your config...(in my post, steps 7 to 11)

If you have done that, may be the following might help you get more info than just a '404' error.

If you are on IE, try to disable "Show Friendly HTTP errors"...usually it will point out the exact error...

on a related note...if you are using short tags (< >) and not (<php) then you must have the "short_open_tag" directive in php.ini set to ON.

In reality...there can be several reasons why you might get a 404 :-)

Anonymous said...

Well done, sir.

Very informative guide and following the directions worked like a champ.

I think that's the key, this is a guide. If you're expecting soemone to do all of your IIS setup, this is not going to work for you.

Thanks.

Anonymous said...

Hi,

The instructions providede here are really useful, I had never worked before with IIS or PHP and I was able to successfully configure the PHP on IIS6/Win2003 server following the instructions. Thanks again.

- Bipin

Dr Who said...

My comment echoes Jennifer's: What to do at Step 7?

Opening the IIS Mgr, I see directory 'Web Sites' under the name of the local computer. Opening this shows Default Web Site and MS SharePoint Administration. I assume that step 7 means 'do something under Web Sites', but what?

Selecting Action > New, I see two options: Web Site and Virtual Directory. Which of the two are you referring to? Or does it not really make a difference?

Help needed here.

However, most of the rest is pretty self-explanatory. Nice.

cipherskull said...

It does not really matter. Its up to you... If you need to run two websites (on different ports) then you create another website. If you need just another "space" then you create a virtual directory, give it some name(e.g: admin) which can then be accessed as http://yourhost/admin

Adriana Lima said...

Nice and very clearly written article. I installed very fast with its help.

Adriana Lima

Anonymous said...

excellent post. It appears from other comments that I may be the only one, but I MUCH prefer the way this post was written as opposed to a detailed, 20 page article with screenshots. I'm a Windows sysadmin not familiar with PHP, and this gave me exactly what I needed to know to get it running.

Anonymous said...

Many thanks. After struggling all day with several other "guides", I found a link to your article. This is quick, easy and most important: It works!

Antonio said...

In 5d, you say do otherstuff. What do you mean by that? And I couldnt find the ones you mentioned such as session mgmt...etc

Brad M. said...

Very helpful post, but I'm running into a weird problem.

Short test script with phpinfo() call in it works fine, once. If I hit refresh in the browser, I get the "Invalid access to memory location" error message. Go to IIS admin panel, stop that website, restart, refresh and it's fine. Refresh again and get the error. All info is correct in the output from phpinfo including php.ini path & extension_dir path. Remaining websites on the server (asp) are all working fine.

Any ideas? (I've been fighting this all day)

raj shekhar said...

Nice Article regarding configuration of PHP in windows

raj shekhar
http://www.softwarecodehelp.com

raj shekhar said...

Nice article regarding configuration of PHP in window server.

G8 buddy

raj shekhar
http://www.softwarecodehelp.com

Deji Odusote said...

Cipherskull, you are a gem but kindly sort me out with the issues on 9.
I do not know where to get the Web service extension to click

Anonymous said...

Hi CS,
your how-to rocks.
However, I still get a 404 on any php-script. No short tags used and everything doublechecked. Is it possible that php can't be run under a x64 system? I am running a Win2003 with IIS6 and try to get php5.2 to run. But as I said... 404!

cipherskull said...

I haven't tried PHP on x64...but to my knowledge, there should be some setting in IIS which would allow you to run 32bit apps.....

if not ...you can run the following to run 32bit apps...

cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 true

hope this helps...

Anonymous said...

I followed your descpription and it works absolutely fine :-))
Thanks a lot
Lars

Anonymous said...

Tried and it works !! Thanks heaps
Danoz

Anonymous said...

Hello I'm configuring PHP with IIS 5.1 under Win2k server... I did all the steps but number 8. I have win2k server in spanish and I cant find some things starting with:

a. Go to the directory tab, click configuration, click Add.
-WHERE???

thanks

Anonymous said...

Hello,
Could u please clarify step 8!!!
Directory tab-where is it???
Before i have created website for asp, but i cannot understand where this directory tab is...
Thank u.

Khadija

cipherskull said...

Khadija:
in your IIS console, if you go to the properties of your Virtual Directory under a website, the directory tab will be as "Virtual Directory". if you go to the properties of your Web Site(like Default Web Site), the directory tab will be "Home Directory"

~cS

Anonymous said...

I installed PHP 5.2 on XP running IIS V5.1. I made the test.php. php cannot locate various DLL's in the ext directory even though they are present.

Here are a few lines

C:\Program Files\PHP>php test.php
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_exif.dll' - The specified module
could not be found.
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_ifx.dll' - The specified module
could not be found.
in Unknown on line 0
...
...
...

Any ideas? Thanks!

cipherskull said...

do you have your php.ini configured properly? and is your php.ini in you %windir%(usually C:
Windows) or in the directory specified by %PHPRC% ?

You need to edit you php.ini and do the following:
uncomment the modules you need to run, set the path to "extension_dir" to your php\ext directory, copy the php.ini to C:\Windows and restart IIS to fix the issue.

Anonymous said...

Yes, I think I have done all these things.

1. In php.ini I
A. set extension_dir =C:\Program Files\PHP\ext\
B. removed the semicolon from in front of extension=php_mysql.dll

2. In my env variables
A. PHPRC = C:\Program Files\PHP\
B. windir = %SystemRoot% (which is c:\Windows

3. Placed copy of php.ini in C:\Windows and verified that there is a copy in C:\Program Files\PHP

4. Stopped and started IIS

I'm stuck. Thanks for any hints!

Anonymous said...

Followed instructions to a T, worked as advertised. PHP up and running in 15 minutes or less. My config - MS Server 2003, PHP 5.2. I'm not very familiar with IIS yet, so I did have some problems locating some of the dialog boxes you referred to. My personal technique (and my advice to you) is screen shot, screen shot, screen shot. Thank you very much for a helpful and informative tutorial.

Anonymous said...

Dear CS,

I followed all the instructions written here...
But when opening the php file, it shows error 500, internal server error...but it opens asp files...what could be wrong...

thank u so much.

Khadija

cipherskull said...

Khadija:
500 errors are usually caused due to misconfiguration/syntax errors.

If you are using IE, go to Tools->Internet Options->Advanced and uncheck "Show Friendly HTTP error messages" and hit refresh. You will get to know if there are any syntax errors in your php file.
Alternately, you can also open a command prompt and run "php <your_php_file>.php" and see if php is processing it successfully.

Anonymous said...

great howto. all worked fine for me but i had to restart my computer in order to reload the path-variable

Anonymous said...

yes,i unchecked, it says The specified module could not be found. !!!
but in a command prompt, it opens the php file, showing the code.

Khadija

cipherskull said...

you need to edit your php.ini and ensure that your modules are enabled(uncommented) and then restart your IIS....and ensure that php.ini is in your windows directory

onesian said...

hi cipherskull, thank you for this, it worked great applying it with php5 on iis 5.1 much thanks :)

Anonymous said...

php.ini is in windows/system32 directory, then, i uncommented all modules in module settings...what is lacking in php.ini file i dont know, what's wrong with module setting....
by the way i use php-4.4.4-Win32

Khadija

cipherskull said...

hmmm can you upgrade to >5 ?

Anonymous said...

yes all i am doing now is upgrading...

Anonymous said...

I upgraded php4>php5, it worked fine, thank u so much indeed.

Khadija

Anonymous said...

I have followed the instractions and got php working fine without any problems, until one day all php pages just started coming up blank. i have reinstalled IIS and can now run a page with phpinfo() on it, but still teh rest of my scripts don't work. any ideas?

philbert

Josh said...

I am looking at installing this on my IIS server, should I install php or mysql first.. I basically need phpMyAdmin MySQL and PHP installed is there an easier way instead of installing all of them seperately. I normally use WAMP to develop PHP but that doesnt look like an option here.

Anonymous said...

Hey Cipher, nice work! I am running IIS 6.0 on a win2003 server and tried to install php 5.2.0 using your instructions. I amanged to be able to follow all the instructions however when I ran the test.php in a broswer I get a 404 error on an external machine and a CGI misbehave error on the localhost that states

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

As I said before I have followed every step, checked and rechecked and cant find what I am doing wrong. I have enabled all the extension in the php.ini file. Could this be a possible cause?

I also checked up on other user problems through the comments and tried to run "php test.php" and get an error that states:

"Cannot run SQLite because required module 'pdo' is not loaded."

I added the php_pdo.dll to the extensions, restarted and still no joy in either environment. Please help!! Thanks in advance

Grant

Anonymous said...

After following the entire instructions, with minor changes :P, I had some trouble to see the pages, 404 and 401 errors. I found that php was working well.

In my case, I just needed, and I hope you add a note to your post, to make sure IUSR_MACHINENANME (the user running IIS processes) had permissions on the php files.

cipherskull said...

Thanks mate, I've updated my post :-)

cheers

Anonymous said...

Thank you for the tips! I'm also getting the 'specified module could not be found' error, yet running php from a cmd prompt works great. Do you have suggestions? Thx!

Anonymous said...

Hi,

I can see all the information on when running phponfo.php except the information about MSSQL.

I have activate mssql extension but still not working :-(

Can somebody help me?

Remi007 said...

thanx very much really very easy guide to config PHP installation, better than the "official" php.net one!!! Really very clear one!
Buut, I got this problem: u said go ->Start->Run->inetmgr my os doesn't display that??? where is the problem? Should I install something extra?!

Anonymous said...

@Anonymous:
Another issue which may give the HTTP500 error is if you don't have the IIS extensions configured correctly in Step 8c.
Handling for paths with spaces is poor, so use the '~' syntax in the IIS Application Configuration step - i.e.
C:\Program Files\PHP\php5isapi.dll
should be entered as:
C:\Progra~1\PHP\php5isapi.dll

alt.Sorcerer said...

Hey there,
Thanks for this great post. I followed the instructions, and i can get my PHP pages to load (sort of). I can't get MySQL to load though, and when i run the phpinfo.php test page, i get a blank screen, no errors, no messages in the tool bar, just a blank screen. Can anyone help?

Thanks much

app

ciscoblog said...

There is a resounding desire for meaningfull freeroll tournaments in which Online Casinos Extreme players at all levels have the opportunity to compete in tournament play when the prize money is huge... but the buyin is somewhat prohibitive most.

Anonymous said...

thanks. this was the best. and actually, ya know, worked! :)

CMoore said...
This post has been removed by the author.
CMoore said...
This post has been removed by the author.
CMoore said...
This post has been removed by the author.
getzeroedin said...
This post has been removed by the author.
Anonymous said...

hi cipher,
i m newer to php.
this is simply gr8, i spent 2 days just to configure php with iis. but i failed, then i started again with your steps and strictly followed it and just amazing... its done, thanx.

Remi007 said...

Thank you so much 4 de help,
well, I did exactly as you said, and everything seems to be OK, the only prob. is: when I create a new virtual directory this page shows up with this message:

500 - An error has occured
An error has occurred while processing your request.

Please try one of the following pages:


Home Page

If difficulties persist, please contact the system administrator of this site.

JDatabase::getInstance: Could not connect to database
The MySQL adapter "mysql" is not available.
--------------
what Im supposed to do? how do i install a mysql database?

Anonymous said...

I have followed all of the steps that you mention. I am getting a blank page when i run the phpinfo() test file. When I try to run the file via the command prompt as you suggested before, it say Access is denied. Any thoughts?

cipherskull said...

make sure your php directory and the directory where you have your .php files have proper security setup...

if you configured your IIS to run as an anonymous user,you need to give the user IIS is running as (usually IUSR_MACHINENAME) permissions on your php directory and files, other wise you will end up with 403 or 404 errors...

dmitriyvi said...

i've spent a great deal of time trying to configure PHP on IIS 6, to the point it got me really mad. i get nasty 'No input file specified.' errors with Firefox or 404 errors with IE. everything has been configured many times over and over using exact instructions from PHP and adjusted around from advices on internet, all to no results. the funny thing is, the previous website that i've created last week (on the same IIS) is working perfectly and has same exact configuration as the new one i'm trying to make. i have an MCP certification and a good amount of experience with setting up websites.
conclusion: microsoft IIS is a shitload of crap.

Girish said...

Hi cipher,
How do I configure to run two php web sites on the same IIS server [on win2k3]?
Actually I have one php site set up and running. Need to set up another php web site on the same server

Anonymous said...

Hi, I love your guide and have found it invaluable. However, after successfully running the test.php file as you suggested, I went on today to install MySQL, and now can't get my testfile to run anymore. I have obviously changed something I shouldn't have. Here's what I am getting, can you provide me with some clues.....all help gratefully received. I'm more of an applications person than a windows programmer, and have had a tad of difficulty working out how to configure the access. Anyway, here's IE's reply to running my test.php file:-

Access denied for user 'ODBC'@'localhost' (using password: NO)Cannot find module (IP-MIB): At line 0 in (none) Cannot find module (IF-MIB): At line 0 in (none) Cannot find module (TCP-MIB): At line 0 in (none) Cannot find module (UDP-MIB): At line 0 in (none) Cannot find module (SNMPv2-MIB): At line 0 in (none) Cannot find module (SNMPv2-SMI): At line 0 in (none) Cannot find module (UCD-SNMP-MIB): At line 0 in (none) Cannot find module (UCD-DEMO-MIB): At line 0 in (none) Cannot find module (SNMP-TARGET-MIB): At line 0 in (none) Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none) Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none) Cannot find module (UCD-DLMOD-MIB): At line 0 in (none) Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none) Cannot find module (SNMP-MPD-MIB): At line 0 in (none) Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none) Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none) Cannot find module (SNMPv2-TM): At line 0 in (none)

Anonymous said...

cipherskull - THANK YOU !!!. I could not figure out why it kept loading a blank page. I tried all that I could but to no avail until I ran into your post about that "short_open_tag". I just turned it to "On" and it worked !!. Thank you very much.

RatRace2 said...

Hey, I have a question:
I have PHP loaded and IIS/odbc
and SQL server 2005--that is my basic setup.
Now, I put a dot.PHP page in the IIS "vir" dir and it runs fine.
If, I do a browse from the IIS dir of Default Web Site.
O.K.: Now that it looks like PHP/IIS are talking to each other how do I get the PHP to work from inside on of the WEB pages in the Default Web Site....
I tried to create a small routing inside my index.html page at the root of the web page with a simple
script omitted: for secutiry
a date method
with a echo to show the results............
But it doesn't seem to work.
It will work on the other hand, if I just select the Test.php page in the IIS default dir web site and click browse.
GOT A CLUE you COULD GIVE ME

RatRace2 said...

Hey, My PHPRC system variable looks like this:

PHPRC I:\Program Files\PHP\dev\ext\extras\PEAR

Shoule I change This:

ALSO:
PATHEXT has WSH;.PHP in it
good/bad what?????

RatRace2 said...

NOW I REMEMBER..:>)
go to Web Site> default web site>
Properties> configuration> to "application extensions".
there we see:
php I:\Program Files\PHP\php-cgi.exe
NOW:
should the Program Files folder name be changed to
Progam~\PHP\php-cgi.exe.
I read another post recommeding such a name change?
Thanks CS from ratrace2

Anonymous said...

Thanks for the very informative instructions. I am running IIS6 and PHP 5.2.

I believe that I have followed everything you suggested. I was unable to complete item #9.

If I run a php file by itself then I obtain the correct output. However, if I try and execute the php file from an html file with a form then i receive a blank screen.

RatRace2 said...

I get the same thing:
If I run a .php file by itelf it displays fine.
If I run a web page with php
code in it I get nothing.....huuuh

RatRace2 said...

I think I have it:
Tell me,please,how to enable php in such a way that all web pages requested from the IIS web server/website are checked by php for server side processing.
I think that is what I need to do: make sure that all web pages are checked for php code and processed by the php engine before they are sent to the client...
Thanks CS from ratrace2

RatRace2 said...

I have an ansewer to your question:
DOES YOUR PHP FILE WORK BUT WHEN YOU PUT YOUR PHP CODE IN AN HTML/WEBPAGE, IT FAILS TO DISPLAY: "ANYTHING AT ALL"...IT JUST COMES UP BLANK....HERE IS THE ANSWER:

YOU HAVE TO LINK TO A .php file; not an html file.
LET ME EXPLAIN:

We know that web site are linked together, right. Yes.
Let's take an example; use two web pages..
Page1....page2.
Now, if webpage1 hs a link to webpage2.html...the php processor will not be called because it is not a .php page...SO>>>>you will the html output but NOT the PHP output because the PHP processor never got called-it couldn't: it can see no .php files.

SO: the answer. Point the reference to you php file(the file that contains the html)to a dot.php file....php. and then you can call the php processor and link to your webpage.
LESSSON:
Most of us are thinking that we are calling html pages, that is right to an extent, but if we want a web page to display php methods and output then we have to call a php dot page and we can link to that page the same way we call an html page.
THE POINT:
change the extension of your html page to php if you have php code in that page...
thank you ratrace2
p.s.PS you are the man

Anonymous said...

Thanks for the suggestion. But I am calling a php file from the html file. I think it is something in my setup that is incorrect.

Anonymous said...

It seems that the html is find the correct php file but it is not executing the php section within the php file.

All I have in the php section is:

?php
print "thank you ";
?
This program ran

If I run just the php file then both "thank you" and "This program ran" appears on the page.

However, if I run just the html file then only "This program ran" appears on the page.

Sjoerd said...

Thnx for youre manual!
However.... couldnt get PHP to run ;(

I followed this one in stead: http://www.peterguy.com/php/install_IIS6.html

I think the problem with my previous installation was the part where I
Uncomment cgi.force_redirect in php.ini and set equal to 0.

Anonymous said...

i found no result in installing php.would u please help me t find the simplest way t instal php?

Anonymous said...

I got a good one for all of you. Install Windows 2000 Server with Hosting controller the other day and went to install PHP 4.4.6 as well.

Everything seems to work fine as in my php sites work and what not so i installed MySQL 4.1 and tried to configure phpmyadmin "any version".

Now for this to work i need to atleast load mbstring extension. Ok sounds simple done it billion times before. HAHAHA

Well after doing this and resetting IIS go to login to phpmyadmin and do with no problems but get mbstring not loaded message at the bottom.

Not the problem but a problem because of this issue.

Did phpinfo and it shows my php.ini path c:\winnt and my extensions directory c:\php4???

Php is installed in c:\php and .ini is also in that directory.

Checked to make sure i had my path set right which it was "c:\php" checked permissions and all was well.

Now why can i not get my my phpinfo to show me that my paths are correct. I tried every registry tweek to get this to change and nothing works.

Funny thing is if i put my php.ini in the winnt directory php stops working. If i change my php folder to php4 and reconfig everything php stops working. LOL

I have no clue what is wrong. Hows that for a messed up php install.

Ben said...

Smashing! Fixed all my problems.

Still, this should all be done by the PHP installer if it worked properly. Bit poor of the PHP team on that matter.

Anyway, THANKS!

danpan said...

fine .. everything is works

Guy said...

HELP!!!!!! Why do i get 500 errors when using PHP with IIS Manually?

Adalberto Generoso da Costa said...

Guy, you save me. hahaha
Good post, I lost a long time for discovery this configuration.

tk's
Adalberto G. da Costa

MT From CC said...

I have a problem. Everything installed perfectly. I can access my website perfectly and I can access my webfilebrowser.php. But the problem is accessing my virtual directories on the webfilebrowser.php. I have tried creating duplicate directories with the same name in the website directory with no success. And one more problem, I can not upload file bigger than 2mb. I have edited the webfilebrowser.php to allow for 1000mb(this being represented in bytes) files and edited the php.ini to correspond to that. so if you can help me with those two things thanks. :)

Anonymous said...

Hi, First thx for this very good procedure, it helps me to get my php page online on my 2003 server.

But i have still problems to use php on my windows xp. Wgen i go to my php page i'm getting an 500 error that says "Invalid access to memory location".
When i do the test in command promt i'm getting my correct output. Can anyone help me please?

Anonymous said...

Hi,
Great explanation and very easy to follow. I installed IIS5.1 and then followed it with PHP 5.2 install, following your steps. It went fine except for the space hiccups in path variables to php*.dll file. I modified that and fired the php test page and it came up just fine.
Thanks for your assistance.

Anonymous said...

Thanks for these great procedures.

I'm experiencing the permissions-related problem that others have run into (I'm being challenged for username/password when I try to view a .php page and getting an Error: Access is Denied message when authentication fails). However, I've examined my settings several times and it looks to me as if the IIS user *does* have permissions on all the directories and files in question.

Any chance someone can provide slightly more detail on *how* to change the permissions for the anonymous (IUSR_MACHINENAME) user? I don't require screenshots or anything of that sort, just pointers to what I should be looking for/entering in which specific places. :) I'm on W2K/IIS5.

TIA for any help you can provide!

Tusto Ferreira said...

Hello,

I followed the instructions, but I can't see a php page working. I tried with .asp and .html and everything goes as expected. with .php page it waits and waits and waits until I get an error like "the page cannot be displayed". Do you have any idea of what might be happening?

Thank you very much for your support.

Anonymous said...

For those not able to acess their page or facing no authorization problems in iis plaease see this post -http://www.wikihow.com/Successfully-Configure-IIs-6-for-Windows-XP-Pro
It has good instructions.

thanks.

Arkady said...

Hey all, this was a great posting, but still had no luck for hours. Kept getting 404 :( By accident found a fix, and wanted to share with all other fellow techies. If you are trying to configure php-cgi for iis6 on win2k2003 server, you needed to go to the Server Extensions node in inetmgr, and allow "All Unknown CGI Extensions". That fixed the 404 on my php test page. BTW, my install was done with the 5.2.2 windows msi installer which did everything except that last step.
-A

Anonymous said...

Instructions were a little off for XP Media Center (yeah, yeah...) but they pointed me in the right direction and everything works! Thanks!

Anonymous said...

I was having issues with Server 2003 and IIS 6. I went through these directions 3 times installing php 5.2.2 - No Luck!
Grabbed the version 4 of php, went through these directions step by step (Substituting version 5 references with version 4 such as php4isapi.dll instead of pjp5isapi.dll) and it works like champ! Thanks CipherSkull for the great post!

Ex

lozano said...

my english is not very good sorry.

i have 2003 server web edition with php 4.4.7.

if i type c:\php> php "c:\inetpub\wwwroot\test.php" then i can see all php config. but, if i type localhost/test.php in firefox or in ie, i obtain a 500 error or "the specified module could not be found"

some idea?

cipherskull said...

In your IIS configuration on your w2k3 server, you need to ensure that you have added a web service extension and also ensure that you have enabled php in your config...(in my post, steps 7 to 11)

If you have done that, may be the following might help you get more info about the error.

If you are on IE, try to disable "Show Friendly HTTP errors"(Tools -> Internet Options -> Advanced, scroll to find "Show Friendly HTTP errors" and uncheck that and restart IE...usually it will point out the exact error...

lozano said...

Only 3 words:

I LOVE YOU

Ranga said...

Hi CS,
I tried configuring PHP 5.2.2 in my windows XP with IIS 5.1
I followed your steps but no luck. I'm get the error "The specified module could not be found"
I uncommented all the extension given in the ini file but still no luck. what could be the problem ?

My PHP Dir is
C:\PHP
I set the module path as
extension_dir = C:\PHP\ext\

Pls advice me how to get PHP up and runing in my windowsXP machine.

BR
Ranga

cipherskull said...

you need to set the phprc variable...

If you are on IE, try to disable "Show Friendly HTTP errors"(Tools -> Internet Options -> Advanced, scroll to find "Show Friendly HTTP errors" and uncheck that and restart IE...usually it will point out the exact error...

Luis said...

Hi, i followed the instructions and execute a page and everything looks fine but after some time when i try to view again the same php I get a blank page in my browser , the other iis capabilities works fine(asp, html). I have no idea of what is happening, if i restart the iis the php works fine again but later i get the same problem...

any idea???

carlos said...

ok I spent 3 days chasing my tail around a 404 error.
read everything, tried evrything, step by step, retrace the steps, rights...
no luck, now trying to troubleshoot I enable directory browsing and tried with a .log file got the same 404, which lead me to start looking into a MIME issue... and yes that was the problem, .php did not exist as a MIME type, I added it with a text/html type
and .... VOILA!!!
don;t know if I had done something on my server before but that solved it
o BTW my config:
windows 2003
iis 6
Me in MN

bernard said...

first thanks for this guide
i'm desperatly stuck in a php.ini location path problem
phpinfo works but still shows php.ini path as c:\windows which it isn't (there's even no php.ini elsewhdere then in c:\php)
and any modification i make on php.ini aka. enable an extension isn't working even after reboot..

any hints?

Anonymous said...

Maybe another tip for people getting 403/404 errors: Make sure you create a virtual directory in IIS by right clicking Default Web Site, New, Virtual Directory. Follow the prompts and tick the Execute tick box.

Anonymous said...

Great guide, I followed it exactly, but I keep getting the same error:


You are not authorized to view this page
The URL you attempted to reach has an ISAPI or CGI application installed that verifies user credentials before proceeding. This application cannot verify your credentials.

HTTP Error 401.5 - Unauthorized: Authorization failed by an ISAPI/CGI application.
Internet Information Services (IIS)


I'm running Windows Server 2003/IIS6/PHP5.2.3 (from a remote computer, if that has any relevance). I may need some very explicit details about how to set permissions (first time on Windows Server). I've been going at this for 2 days now, and I've looked at 10 other guides, and none address this problem. Is this a problem with my php configuration or with IIS6? Any help would be EXTREMELY appreciated. Thanks in advance.

cipherskull said...

You need to give the user IIS is running as (usually IUSR_MACHINENAME) permissions on your php directory and files, other wise you will end up with 403 or 404 errors... also, check your IIS config to see if you are using windows authentication or Anonymous....right click on 'Default Web Site', select properties, click on Directory Security, click on Edit and verify the security settings....

also,

Anonymous said...

> You need to give the user IIS is running as (usually IUSR_MACHINENAME) permissions on your php directory and files, other wise you will end up with 403 or 404 errors...

Please let me know if I did this correctly: I right-clicked on c:\php, selected Properties, selected the Security tab, clicked Add, typed IUSR_MY_MACHINE_NAME, clicked Check Names (successfully), clicked OK, gave this new user modify, and clicked OK.

> also, check your IIS config to see if you are using windows authentication or Anonymous....right click on 'Default Web Site', select properties, click on Directory Security, click on Edit and verify the security settings....

I assume by Edit you mean authentication and access control. However, verifying would require me to know what the security settings should be, which I do not.

> also,

Was there anything else? Thanks so much for you help!

annerose said...

These comments have been invaluable to me as is this whole site. I thank you for your comment.

Jitendra said...

Thanks for this post...been very useful...you rock..

and this for guys struggling to run "php test.php" and getting cant find module..blah..blah..error msgs....Guys, try to run this command where test.php file resides...not anywhere.

Jitu

Ludo said...

Thanks fo your post ;)

Edward Slipszenko said...

Hey, I'm running IIS 5.1 and I'm trying to install php 5. I strictly followed your instructions yet it's still kicking up this error:

HTTP/1.1 404 Object Not Found

I have asp and asp.net and ruby currently installed on the machine, will that effect it?

Anonymous said...

I am having a problem getting php to load in both of my sites. I was able to get one of my sites to load. I have gone through the config panels for both sites and they appear to be identical. Can someone help me?

Juan Pablo Rodriguez said...

Very nice guide thank you, I am using win2003 server standard with IIS6 and php 5.2.3. By the way for newbies like me, if you want your php_oci8.dll extension to work, don't forget to install the oracle client, and a final reboot was needed for php to load the extensions.

ranu said...

thanku so much.. u really helped me so much.. i got ur page after searching a lot for proper installation of php.. i had a lot of problems.. bt as i followed these instructions.. they magically helped..! :)
thanks a lot!

bt still i have a prob that php well works on ie bt whn i use firefox localhost asks for authorization! donno what alien usename & password it wants! can u plz help me out.?
thanks in advance! :)
*i'm using php5.2.3 with IIS5.1

Brady said...

I found a post on this page that helped me with the 404 error on Windows Server 2003.

http://www.simongibson.com/intranet/php2003/

The key is the section where he talks about added the Web Service Extention and checking the box to allow it.

I hope this helps some of you that were stuck on the 404 Error like I was.

--Brady

CreditStudent said...

php on IIS 6 is a great idea! Thank you!
It was a little bit hard for me. But I did it… You know, my first victory in the coder career)

Home Insurance said...

One of the most fun and beautifully written posts for the last time, thank you.

If interested, can visit Home Insurance All Best blog.

<a href="http://m2.aol.com/as34f">Anonymous</a> said...

Do you can write anything else about it? Great article!

Anonymous said...

"Invalid access to memory location" error:
I have PHP installed as ISAPI on IIS6. I was having problem with this error, and i managed to solve it by removing EXIF extension from PHP.ini. It now works fine.
Hope this helps, I was trying to fix this bug for days and lost lots of nerves.
Bye, support@cro-hosting.com

Anonymous said...

Tried using these instructions with IIS 5.1, eventually re-read the title and realised it ain't going to work...

Tried this instead http://www.razorx.com/tutorials/PHPonIIS/

and it worked first time!!

Anonymous said...

You are awesome! The I_USR rights was all I needed to make my installation work. This is the best write up I have found yet. Have a virtual beer on me.

Anonymous said...

Under Debian Loonix, installing php support is one simple step!

apt-get install php5

and you're done! :D

Anonymous said...

Not sure IIS is the right place for PHP.

Anonymous said...

** DO NOT FORGET TO PUT THE TRAILING BACKSLASH.**

OMG, what year is this? How hard is it to strip off a trailing backslash? This is so stupid. PHP, grow up.

Anonymous said...

Why why why? Last I heard Apache runs on Windows.

Anonymous said...

I do not understand why you are using IIS in the first place. There is no logical or sane reason to use it above Apache. If your code is ASP, then you need a real website. Everything else works better and more securely running Debian or a similar Linux based OS.

Anonymous said...

I think wow gold is better than world of warcraft gold i always Buy WoW gold with cheap wow gold so u Do u like play nba live with nba live 2008 can play wow gold also then Buy WoW gold need to world of warcraft gold u can go google排名 or cheap wow gold i think its google左侧排名

<a href="http://paydayadvisors.org">PaydayLoans</a> said...

gH0u21 You have a talant! Write more!

<a href="http://tes.uab.es/MISS/portal_memberdata/portraits/twkgxziok">Auto insurance company</a> said...

6g96lM Magnific!

Manish Sharma said...

phpsource code pld click and see here

http://www.phpsourcecode.blogspot.com

<a href="http://hydrocodone.99k.org/index.php">Hydrocodone</a> said...

wknkc2 The best blog you have!

<a href="http://users2.titanichost.com/buyviagra/309.html">illinois department of insurance workers co</a> said...

OBRWD9 Please write anything else!

<a href="http://free.7host07.com/nmcfgy/333.html">alps tour august cycl</a> said...

Nice Article.

<a href="http://fioricet.clanteam.com/?pharma=24">bbs fioricet href</a> said...

Good job!

<a href="http://celebrex.zxq.net/?pharma=1299">celebrex vioxx side effects</a> said...

Please write anything else!

<a href="http://m1.aol.com/BrettHead14/77.html">assurian insurance</a> said...

Magnific!

<a href="http://users2.titanichost.com/buyviagra/index9.html">phentermine home</a> said...

Wonderful blog.

<a href="http://tramadol.newsit.es/tramadol-and-nausea.html">tramadol and nausea</a> said...

Thanks to author.

<a href="http://vicodin.newsit.es/cod-online-vicodin.html">cod online vicodin</a> said...

Thanks to author.

<a href="http://tramadol.newsit.es/denosyl-and-tramadol.html">denosyl and tramadol</a> said...

Good job!

<a href="http://phentermine.whdot.com/index.html">viagra</a> said...

Good job!

<a href="users2.titanichost.com/amalopra">JohnBraun</a> said...

yPcbQw write more, thanks.

<a href="http://users2.titanichost.com/popebatret/index25.html">college sex magazine</a> said...

Thanks to author.

<a href="http://users2.titanichost.com/inoryum/index30.html">dry sex photo</a> said...

Hello all!

<a href="http://users2.titanichost.com/hviler/index9.html">animation sex teen</a> said...

Hello all!

<a href="http://users2.titanichost.com/ansfur/index10.html">lebens having sex</a> said...

Hello all!

<a href="http://users2.titanichost.com/olds77/index1.html">easygal anal blowjob</a> said...

Hello all!

<a href="http://users2.titanichost.com/shingro/index3.html">sex addict diary</a> said...

Good job!

<a href="http://users2.titanichost.com/scersi/index2.html">ebony sex nympho</a> said...

Hello all!

<a href="http://users2.titanichost.com/t1fielde/index6.html">pamanderson sex tape</a> said...

Good job!

<a href="http://users2.titanichost.com/adjutes/index30.html">bbw model sex</a> said...

Please write anything else!

<a href="http://users2.titanichost.com/adjutes/index4.html">bbc documentary sex</a> said...

Magnific!

<a href="http://users2.titanichost.com/shiconta/index29.html">cyber picture sex</a> said...

Please write anything else!

<a href="http://users2.titanichost.com/gnites3/index27.html">hot anala sex</a> said...

Nice Article.

<a href="http://users2.titanichost.com/marymeno/index32.html">private sex filme</a> said...

Good job!

<a href="http://users2.titanichost.com/vadhoms/index26.html">making sex happen</a> said...

A flashlight is a case for holding dead batteries.

<a href="http://users2.titanichost.com/etooking/index21.html">nude latin sex</a> said...

Magnific!

<a href="http://users2.titanichost.com/swiseny/index21.html">dick sucking sex</a> said...

Please write anything else!

<a href="http://users2.titanichost.com/Lostsoldier3/index5.html">free lesbian porn without credit ca</a> said...

Calvin, we will not have an anatomically correct snowman!

<a href="http://users2.titanichost.com/pyzoid/index3.html">bolocco oral sex</a> said...

Save the whales, collect the whole set

<a href="http://users2.titanichost.com/pyzoid/index7.html">brazil sex workers</a> said...

What is a free gift ? Aren't all gifts free?

<a href="http://users2.titanichost.com/selli83/index10.html">ager sex teen</a> said...

Lottery: A tax on people who are bad at math.

<a href="http://users2.titanichost.com/numdaso/index11.html">japan 500 sex</a> said...

All generalizations are false, including this one.

<a href="http://users2.TitanicHost.com/beveris/hydrocodone-inhaled.html">hydrocodone inhaled</a> said...

Wonderful blog.

<a href="http://cialis.whdot.com/index6.html">cialis anti impotence</a> said...

Please write anything else!

<a href="http://web.archive.org/web/20070818073944/xanga.com/buyultramonline">cheap ultram</a> said...

Wonderful blog.

<a href="http://users2.titanichost.com/numdaso/index23.html">intra racial sex</a> said...

Wonderful blog.

<a href="http://users2.titanichost.com/febisko/index32.html">belgium teen sex</a> said...

Lottery: A tax on people who are bad at math.

<a href="http://users2.titanichost.com/topletrufus/index30.html">geman movie sex</a> said...

I don't suffer from insanity. I enjoy every minute of it.

<a href="http://users2.titanichost.com/yetzeit/index9.html">asian sex wife</a> said...

Friends help you move. Real friends help you move bodies.

<a href="http://users2.titanichost.com/brittanyrogers/56-0411.html">all hct sex</a> said...

Ever notice how fast Windows runs? Neither did I.

<a href="http://users2.titanichost.com/glicia80/index28.html">sex audio tapes</a> said...

C++ should have been called B

<a href="http://users2.titanichost.com/reekello/index10.html">devon wife sex</a> said...

Suicidal twin kills sister by mistake!

<a href="http://users2.titanichost.com/tortene/index3.html">obese sex videos</a> said...

A lot of people mistake a short memory for a clear conscience.

<a href="http://users2.TitanicHost.com/kopelar/clonidine-s263.html">clonidine s263</a> said...

Lottery: A tax on people who are bad at math.

name said...

Oops. My brain just hit a bad sector.

<a href="http://users2.titanichost.com/cuhozhilov/index26.html">email porn service</a> said...

Hello all!

<a href="http://users2.titanichost.com/robertf/index10.html">rss porn feed for psp</a> said...

Calvin, we will not have an anatomically correct snowman!

<a href="http://users2.titanichost.com/maxeevich/index32.html">ananicole smith porn</a> said...

Thanks to author.

<a href="http://users2.titanichost.com/dityroe/index34.html">lesund sex debut</a> said...

All generalizations are false, including this one.

<a href="http://users2.titanichost.com/liperwo/index1.html">babe sex workout</a> said...

Hello all!

<a href="http://users2.titanichost.com/dasistorama/index21.html">free schoolgirl porn naked nude bab</a> said...

All generalizations are false, including this one.

<a href="http://users2.titanichost.com/rego07/index32.html">chill porn sites</a> said...

Energizer Bunny Arrested! Charged with battery.

<a href="http://users2.titanichost.com/artinko/index6.html">get into the best teens porn sites with</a> said...

When there's a will, I want to be in it.

<a href="http://users2.titanichost.com/lindafmosley/index28.html">anal sex oral torture painful anal</a> said...

actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.

<a href="http://users2.titanichost.com/tereritoa1/index7.html">full sex sue</a> said...

Clap on! , Clap off! clap@#&$NO CARRIER

<a href="http://users2.titanichost.com/eynol/index28.html">porn video of american idol contestant</a> said...

The gene pool could use a little chlorine.

<a href="http://users2.titanichost.com/dentouj/index10.html">hentai young sex</a> said...

Change is inevitable, except from a vending machine.

<a href="http://users2.TitanicHost.com/turtra/ic-oxycodone-w-apap.html">ic oxycodone w apap</a> said...

Give me ambiguity or give me something else.

<a href="http://users2.titanichost.com/bybonte/index24.html">celebs sex machine</a> said...

Suicidal twin kills sister by mistake!

<a href="http://users2.titanichost.com/unareq/index3.html">photo school sex</a> said...

Lottery: A tax on people who are bad at math.

<a href="http://users2.titanichost.com/mezers/index20.html">british sex mature</a> said...

Nice Article.

<a href="http://users2.titanichost.com/deswef/index29.html">ceaser sex machien</a> said...

640K ought to be enough for anybody. - Bill Gates 81

<a href="http://users2.titanichost.com/tedethe/index1.html">free goat sex</a> said...

Nice Article.

<a href="http://users2.titanichost.com/simpleplayer/index17.html">immature porn</a> said...

If ignorance is bliss, you must be orgasmic.

<a href="http://users2.titanichost.com/sobermi/index26.html">interracial sex comcis</a> said...

What is a free gift ? Aren't all gifts free?

<a href="http://users2.titanichost.com/clydej/index29.html">website to watch porn for free</a> said...

Please write anything else!

<a href="http://users2.titanichost.com/xcalomi/index26.html">karolina kurkova sex</a> said...

Oops. My brain just hit a bad sector.

«Oldest ‹Older   1 – 200 of 214   Newer› Newest»