Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIS and PHP problem ....

Status
Not open for further replies.

bogtom

Programmer
Jun 11, 2001
31
US
I try to install PHP module into IIS on a W2000 system like in the documentation from ! I receive error messages like :

Notice: Undefined variable : name in c:\inetpub\ on line 3

and at line 3 I have : if ($name=="John")

Which is the error ? I test this with an Apache server with php and it works very well....
 
Have you gone into IIS and set it up to process php?

Go into the "Control Panel" then into "Administrative Tools".
Then into "Internet Services Manager".

Expand the + next to your computer on the left side of the window.

Right-click on "Default Web Site" and choose "Properties".

Click the "Home Directory" tab and then click the "Configuration" button.

Click "Add" and locate "PHP.exe" Under extension put in ".php" without the quotes.

See if that helps you....unless you already did this.

====================================
I love people. They taste just like
chicken!
 
Could you post a little more of your code please? ====================================
I love people. They taste just like
chicken!
 
something like this.... and the error is on the third line ..... on IIS of course !!!!


<?php

if ($loc == &quot;admin&quot;)
{
?>

<tr bgcolor=&quot;#ffffff&quot;><td>
<table width=&quot;100%&quot;>
<tr><td align=&quot;left&quot;>
<img src=&quot;../imagini/nimic.gif&quot; height=&quot;1&quot; width=&quot;20&quot;><img src=&quot;../imagini/uvt.gif&quot;>
</td><td align=&quot;right&quot; valign=&quot;bottom&quot;>
 <script language=&quot;JavaScript&quot;>data()</script>
</td><td>
<img src=&quot;../imagini/nimic.gif&quot; height=&quot;2&quot; width=&quot;7&quot;>
</td></tr>
</table>
</td></tr>

<?php
}
else
{
?>

<tr bgcolor=&quot;#ffffff&quot;><td>
<table width=&quot;100%&quot;>
<tr><td align=&quot;left&quot;>
<img src=&quot;imagini/nimic.gif&quot; height=&quot;1&quot; width=&quot;20&quot;><img src=&quot;imagini/uvt.gif&quot;>
</td><td align=&quot;right&quot; valign=&quot;bottom&quot;>
 <script language=&quot;JavaScript&quot;>data()</script>
</td><td>
<img src=&quot;imagini/nimic.gif&quot; height=&quot;2&quot; width=&quot;7&quot;>
</td></tr>
</table>
</td></tr>

<?php } ?>
 
No, you're not looking at your code right.

I strongly suggest that you rewrite your script so that your code doesn't keep switching context between execution mode and output mode.

Put a &quot;<?php&quot; at the beginning of the file, a &quot;?>&quot; at the end of the file, and when you need to output, use either &quot;print&quot; or &quot;echo&quot;.

Here's what I mean, using the code you posted:

Code:
<?php

if ($loc == &quot;admin&quot;)
{
     print '
<tr bgcolor=&quot;#ffffff&quot;><td>
    <table width=&quot;100%&quot;>
           <tr><td align=&quot;left&quot;>
                   <img src=&quot;../imagini/nimic.gif&quot; height=&quot;1&quot; width=&quot;20&quot;><img src=&quot;../imagini/uvt.gif&quot;>
           </td><td align=&quot;right&quot; valign=&quot;bottom&quot;>
                     <script language=&quot;JavaScript&quot;>data()</script>
           </td><td>
                     <img src=&quot;../imagini/nimic.gif&quot; height=&quot;2&quot; width=&quot;7&quot;>
           </td></tr>
    </table>
</td></tr>';

}
else
{
	print '
<tr bgcolor=&quot;#ffffff&quot;><td>
    <table width=&quot;100%&quot;>
           <tr><td align=&quot;left&quot;>
                   <img src=&quot;imagini/nimic.gif&quot; height=&quot;1&quot; width=&quot;20&quot;><img src=&quot;imagini/uvt.gif&quot;>
           </td><td align=&quot;right&quot; valign=&quot;bottom&quot;>
                     <script language=&quot;JavaScript&quot;>data()</script>
           </td><td>
                     <img src=&quot;imagini/nimic.gif&quot; height=&quot;2&quot; width=&quot;7&quot;>
           </td></tr>
    </table>
</td></tr>';

}

?>

The problem is that PHP's error messages are relative to number of lines of execution, not number of lines in the file.  If you keep switching context, the line numbers don't jibe between PHP and your editor. ______________________________________________________________________
TANSTAAFL!
 
I tested both scripts (with IIS 4.0 and PHP 4.2.2) but there is no different result than before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top