Hi,

I have just moved from a Linux server to a Windows 2003 Web Edition server and have setup IIS6, PHP5, and MySQL5 myself as it's a dedicated server.

The issue is I have PHP scripts which would run fine on the Linux box with SCRIPT_NAME in them, but for some reason they will not work on the IIS6 server.

There is nothing echo'd where the SCRIPT_NAME command is.

The phpinfo() output is here -

http://www.bench-uk.co.uk/phpinfo.php

and the script is -

PHP Code:
<?php

include("config.php");

    if(isset(
$_GET['id']) == TRUE) {
        if(
is_numeric($_GET['id']) == FALSE) {
            
$error 1;
        }
        if(
$error == 1) {
            
header("location:".$config_basedir);
        }
        else {
            
$validentry $_GET['id'];
        }
    }
    else {
        
$validentry 0;
    }    

    if(
$_POST['submit']) {
        
$db mysql_connect($dbhost$dbuser$dbpassword);
        
mysql_select_db($dbdatabase$db);
        
        
$sql "INSERT INTO comments(blog_id, dateposted, name, comment) VALUES('".$validentry."',NOW(), '".$_POST['name']."', '".$_POST['comment']."')";
        
mysql_query($sql);
        
header("Location: http://" $HTTP_HOST $SCRIPT_NAME "?id=" $validentry);
    }
    else {
        
// Code will go here
    
}

include(
"header.php");

    if(
$validentry == 0) {
        
$sql "SELECT entries.*, categories.cat FROM entries, categories
                WHERE entries.cat_id = categories.id
                ORDER BY dateposted DESC
                LIMIT 1"
;
    }
    else {
        
$sql "SELECT entries.*, categories.cat FROM entries, categories
                WHERE entries.cat_id = categories.id
                AND entries.id = "
.$validentry"
                ORDER BY dateposted DESC
                LIMIT 1"
;
    }
    
$result mysql_query($sql);    
    
$row mysql_fetch_assoc($result);
    
    echo 
"<h2>" .$row['subject']. "</h2><br />";
    echo 
"<i>In ".$row['cat']." - Posted on ".date("D jS F Y g.iA"strtotime($row['dateposted']))."</i>";
    echo 
"<p>";
    echo 
nl2br($row['body']);
    echo 
"</p>";
    
    
$commsql "SELECT * FROM comments WHERE blog_id = ".$validentry." ORDER BY dateposted DESC";
    
$commresult mysql_query($commsql);
    
$numrows_comm mysql_num_rows($commresult);
    
    if(
$numrows_comm == 0) {
        echo 
"<p>No Comments</P>";
    }
    else {
        
$i 1;
        
        while(
$commrow mysql_fetch_assoc($commresult)) {
            echo 
"<a name='comment".$i."'></a>";
            echo 
"<h3>Comment by " .$commrow['name']." on ".date("D jS F Y g.iA"strtotime($commrow['dateposted']))."</h3>";
            echo 
$commrow['comment'];
            
$i++;
        }
    }

?>

<h3>Leave a comment</h3>

<form action="<?php echo $SCRIPT_NAME."?id=".$validentry?>" method="post">

<table>
    <tr>
        <td>Your Name</td>
        <td><input type="text" name="name"></td>
    </tr>
    <tr>
        <td>Comments</td>
        <td><textarea name="comment" rows="10" cols="30"></textarea></td>
    </tr>
    <tr>
        <td></td>
        <td><input type="submit" name="submit" value="Add Comment"></td>
    </tr>
</table>
</form>

<?php

include("footer.php");

?>
If anyone can shed any light on this, please help.

Thanks
Adam