Page 1 of 1

Running PHP in IIS

Posted: Mon Feb 27, 2006 9:10 am
by vietboy505
I did the exact from this link to show how to install PHP in IIS. http://www.webthang.co.uk/tuts/tuts_ser ... hp_iis.asp

Then I create a folder where I will work on the web.

I test out the PHP, and it works for http://localhost/webportal/test.php where test.php is

Code: Select all

<?PHP
phpinfo();
?>
And when I try http://localhost/webportal/index.php The page cannot be found even though my code for index.php is:

Code: Select all

<html>
<head>
<link href="images/style.css" rel="stylesheet" type="text/css" />
<LINK REL="SHORTCUT ICON" HREF="images/favicon.ico">
</head>

<div id=menu style="float:left">
<?php include('nav_link.php') ?>
</div>

<div id="header">
<?php include('logo.php') ?>
</div>

<div id="footer">
<?php include('copyright.php') ?>
</div>
</html>
Any one know why this is not working?
Path to execute pHP is C:\PHP\php-cgi.exe

Posted: Mon Feb 27, 2006 10:13 am
by RobertGonzalez
Save your current index.php as index_old.php. Save your current test.php as index.php and run it. See what happens. Also, check to see if your browser is throwing any errors. Sometimes a page not found error (expecially in Internet Explorer) looks like a 500 Internal Server error page.

Posted: Mon Feb 27, 2006 11:00 am
by vietboy505
works fine after renaming test.php to index.php

Code: Select all

phpinfo()
System  Windows NT 5.1 build 2600  
Build Date  Jan 11 2006 16:35:21  
Configure Command  cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"  
Server API  CGI/FastCGI  
Virtual Directory Support  enabled  
Configuration File (php.ini) Path  C:\WINNT\php.ini  
PHP API  20041225  
PHP Extension  20050922  
Zend Extension  220051025  
Debug Build  no  
Thread Safety  enabled  
Zend Memory Manager  enabled  
IPv6 Support  enabled  
Registered PHP Streams  php, file, http, ftp, compress.zlib  
Registered Stream Socket Transports  tcp, udp  
Registered Stream Filters  convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, zlib.*
I don't why it doesn't work for my original index.php

Posted: Mon Feb 27, 2006 11:20 am
by Burrito
hard to say without seeing your included files.

Start small, then build up to see what's causing the problem.

Posted: Mon Feb 27, 2006 12:01 pm
by vietboy505

Code: Select all

index.php
<html> 
<head> 
<link href="images/style.css" rel="stylesheet" type="text/css" /> 
<LINK REL="SHORTCUT ICON" HREF="images/favicon.ico"> 
</head> 

<div id=menu style="float:left"> 
<?php include('nav_link.php') ?> 
</div> 

<div id="header"> 
<?php include('logo.php') ?> 
</div> 

<div id="footer"> 
<?php include('copyright.php') ?> 
</div> 
</html>  


nav_link.php

<a href=http://url>link 1</a><br>
<a href=http://url>link 2</a><br>
<a href=http://url>link 3</a><br>
<a href=http://url>link 4</a> <br>

logo.php
<a href="http://www.google.com" target="_blank">
<img src="images/logo.gif" border="0"></a>

copyright.php
<?php

if (date("Y") == "2006") { 
	echo "&copy;2006 COMP"; 
} else { 
	echo "&copy;2006-" . date("Y") . "COMP";
}
?>
Full code above...

Posted: Mon Feb 27, 2006 12:05 pm
by Burrito
I've had a similar issue before. I think I resolved the issue, by copying all of the text of the file into notepad, then saving it again. I think it's a funked windows permissions issue.

you might need to do that with all of your included files as well.

Posted: Mon Feb 27, 2006 12:10 pm
by vietboy505
Burrito,

You're right.

I moved it all to different folder, and use notepad to open again and save as.
And it works..

I wonder why it doesn't work from the beginning with Textpad editor.

Thanks!