...

View Full Version : apache migration to iis



rock_14
08-13-2007, 07:30 PM
I have a Web site and MySQL db that works fine on apache. I moved the application to IIS. After doing all of the configuration steps, it appears to run php scripts on index.php but not on any of the other pages of the application. For example, on index.php I do a phpinfo() and it shows all the information. Partial output on IIS that I get is shown below for phpinfo()

Server API CGI/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path C:\WINDOWS
Loaded Configuration File C:\PHP\php.ini
PHP API 20041225
PHP Extension 20060613
Zend Extension 220060519
Debug Build no
Thread Safety disabled
Zend Memory Manager enabled
IPv6 Support enabled
Registered PHP Streams php, file, data, http, ftp, compress.zlib


Yet, on all of the other pages it just splatters the php all over the page: Here are some example errors I am getting on one page:


PHP Warning: include(/include/session.php) [function.include]: failed to open stream: No such file or directory in D:\Inetpub\wwwroot\wbase\main.php on line 2 PHP Warning: include() [function.include]: Failed opening '/include/session.php' for inclusion (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\wbase\main.php on line 2 PHP Warning: include(/dinclude/dheaderclean.php) [function.include]: failed to open stream: No such file or directory in D:\Inetpub\wwwroot\wbase\main.php on line 3 PHP Warning: include() [function.include]: Failed opening '/dinclude/dheaderclean.php' for inclusion (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\wbase\main.php on line 3 PHP Warning: include(/dheader.php) [function.include]: failed to open stream: No such file or directory in D:\Inetpub\wwwroot\wbase\main.php on line 4 PHP Warning: include() [function.include]: Failed opening '/dheader.php' for inclusion (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\wbase\main.php on line 4 PHP Warning: include(/open_conn.php) [function.include]: failed to open stream: No such file or directory in D:\Inetpub\wwwroot\wbase\main.php on line 5 PHP Warning: include() [function.include]: Failed opening '/open_conn.php' for inclusion (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\wbase\main.php on line 5 PHP Notice: Undefined variable: session in D:\Inetpub\wwwroot\wbase\main.php on line 32 PHP Notice: Trying to get property of non-object in D:\Inetpub\wwwroot\wbase\main.php on line 32 PHP Notice: Undefined variable: form in D:\Inetpub\wwwroot\wbase\main.php on line 53 PHP Notice: Trying to get property of non-object in D:\Inetpub\wwwroot\wbase\main.php on line 53

Does anyone have any ideas on what I might be doing wrong? I have spent quite a few hours trying to figure this out and really could use some advice.

Thanks

_Aerospace_Eng_
08-13-2007, 08:17 PM
The issue is the leading forward slash. Its telling the server to look at the root of the site for the include file. In this case the root is D: so its looking for the file here
D:\include\session.php

Try doing something like

include($_SERVER['DOCUMENT_ROOT'].'/wbase/include/session.php')

rock_14
08-13-2007, 08:35 PM
Thanks a million!:)

rock_14
08-13-2007, 08:44 PM
Thanks for the help. I think you are right that this is the problem, but after making the change I get this:

PHP Notice: Undefined index: DOCUMENT_ROOT in D:\Inetpub\wwwroot\wbase\main.php on line 7 PHP Warning: include(/wbase/include/session.php) [function.include]: failed to open stream: No such file or directory in D:\Inetpub\wwwroot\wbase\main.php on line 7 PHP Warning: include() [function.include]: Failed opening '/wbase/include/session.php' for inclusion (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\wbase\main.php on line 7 PHP Notice: Undefined index: DOCUMENT_ROOT in D:\Inetpub\wwwroot\wbase\main.php on line 8 PHP Warning: include(/wbase/dinclude/dheaderclean.php) [function.include]: failed to open stream: No such file or directory in D:\Inetpub\wwwroot\wbase\main.php on line 8 PHP Warning: include() [function.include]: Failed opening '/wbase/dinclude/dheaderclean.php' for inclusion (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\wbase\main.php on line 8 PHP Notice: Undefined index: DOCUMENT_ROOT in D:\Inetpub\wwwroot\wbase\main.php on line 9 PHP Warning: include(/wbase/dheader.php) [function.include]: failed to open stream: No such file or directory in D:\Inetpub\wwwroot\wbase\main.php on line 9 PHP Warning: include() [function.include]: Failed opening '/wbase/dheader.php' for inclusion (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\wbase\main.php on line 9 PHP Notice: Undefined index: DOCUMENT_ROOT in D:\Inetpub\wwwroot\wbase\main.php on line 10 PHP Warning: include(/wbase/open_conn.php) [function.include]: failed to open stream: No such file or directory in D:\Inetpub\wwwroot\wbase\main.php on line 10 PHP Warning: include() [function.include]: Failed opening '/wbase/open_conn.php' for inclusion (include_path='.;C:\php5\pear') in D:\Inetpub\wwwroot\wbase\main.php on line 10 PHP Notice: Undefined variable: session in D:\Inetpub\wwwroot\wbase\main.php on line 36 PHP Notice: Trying to get property of non-object in D:\Inetpub\wwwroot\wbase\main.php on line 36 PHP Notice: Undefined variable: form in D:\Inetpub\wwwroot\wbase\main.php on line 57 PHP Notice: Trying to get property of non-object in D:\Inetpub\wwwroot\wbase\main.php on line 57

Any idea on what else to try?

_Aerospace_Eng_
08-13-2007, 08:49 PM
Can you post the code (including the php) for main.php?

rock_14
08-13-2007, 08:51 PM
Thanks for the help again. Here is the code for main.php



<?php
//include("/include/session.php");
//include("/dinclude/dheaderclean.php");
//include("/dheader.php");
// include("/open_conn.php");

include($_SERVER['DOCUMENT_ROOT'].'/wbase/include/session.php');
include($_SERVER['DOCUMENT_ROOT'].'/wbase/dinclude/dheaderclean.php');
include($_SERVER['DOCUMENT_ROOT'].'/wbase/dheader.php');
include($_SERVER['DOCUMENT_ROOT'].'/wbase/open_conn.php');
//include("/Inetpub/wwwroot/wbase/include/session.php");

/*
* Main.php
*
* This is an example of the main page of a website. Here
* users will be able to login. However, like on most sites
* the login form doesn't just have to be on the main page,
* but re-appear on subsequent pages, depending on whether
* the user has logged in or not.
*
*/

?>

<html>
<title>Login Script</title>
<body>
<table>
<tr><td>

<?php
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/

if($session->logged_in){
echo "<h4>Login Successful</h4>";
echo "Welcome <b>$session->username</b>, you are logged into the Dawson Permit Portal. <br><br>"
."[<a href=\"userinfo.php?user=$session->username\">Manage Permits</a>] &nbsp;&nbsp;"
."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
if($session->isAdmin()){
echo "[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
}
echo "[<a href=\"process.php\">Logout</a>]";
}
else{
?>

<h3>Login</h3>
<?php
/**
* User not logged in, display the login form.
* If user has already tried to login, but errors were
* found, display the total number of errors.
* If errors occurred, they will be displayed.
*/
if($form->num_errors > 0){
echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="POST">
<table align="right" border="1" cellspacing="0" cellpadding="1">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
</table>
</form>

<?php
}
/**
* Just a little page footer, tells how many registered members
* there are, how many users currently logged in and viewing site,
* and how many guests viewing site. Active users are displayed,
* with link to their user information.
*/
echo "</td></tr><tr><td align=\"center\"><br><br>";

/**'echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
'echo "There are $database->num_active_users registered members and ";
echo "$database->num_active_guests guests viewing the site.<br><br>";
*/

include("include/view_active.php");

?>
</td></tr>
</table>
</body>
</html>
<?php
include("dinclude/dfooter.php");
?>

_Aerospace_Eng_
08-13-2007, 08:54 PM
It almost looks like php wasn't installed correctly. You do know you can install apache on windows right?

rock_14
08-13-2007, 08:56 PM
Yes, there may be problems with the Install. Actually I am thinking now that it will be better maybe just to install Apache on Windows. That is what I did before, but I was tempted to just try throwing the files into IIS and seeing if I could get it to work.

I think I will try installing apache. Thanks again for the help.

_Aerospace_Eng_
08-13-2007, 08:59 PM
There a few installer packages that can do this for you so you don't have to waste time getting things to work. XAMPP (http://apachefriends.org/en/xampp.html) is the installer I use and it works great.

rock_14
08-13-2007, 09:00 PM
It almost looks like php wasn't installed correctly. You do know you can install apache on windows right?

Ok, I downloaded apache and tried installing it on this Windows 2003 computer. The message I get is no socket available. Could not bind 0.0.0.0. Does that mean anything to you?

Apache is installed in the sense that I see the feather icon in the bottom right corner of the screen. When I click start it just says operation failed.

_Aerospace_Eng_
08-13-2007, 09:04 PM
I suggest you use the installer package I mentioned. It will save you the hassle of trying to install apache on your own.

rock_14
08-13-2007, 09:09 PM
I suggest you use the installer package I mentioned. It will save you the hassle of trying to install apache on your own.

Thanks, but I have a question about this. I read somewhere it shouldn't be used on live production sites. What do I do download it and install it, and then when it works what do I do about the security problems with XAMPP?

_Aerospace_Eng_
08-13-2007, 09:17 PM
Thats only because out of the box many of its features like mysql, and phpmyadmin have no password set to them. XAMPP allows you to set these under the security settings on the xampp main page (http://localhost/xampp/)

Good link here you should read. http://www.uhost4free.com/xampp.htm

rock_14
08-13-2007, 09:38 PM
Thats only because out of the box many of its features like mysql, and phpmyadmin have no password set to them. XAMPP allows you to set these under the security settings on the xampp main page (http://localhost/xampp/)

Good link here you should read. http://www.uhost4free.com/xampp.htm

Thank you for your really excellent help. By the way, do you do consulting work?

Spookster
08-13-2007, 09:39 PM
Just as a side note when you run Apache make sure you shut down IIS first.

_Aerospace_Eng_
08-13-2007, 09:39 PM
Thank you for your really excellent help. By the way, do you do consulting work?
Yes I do, PM me with more details.

rock_14
08-13-2007, 09:47 PM
Thanks, I did that.

rock_14
08-13-2007, 09:48 PM
Ok, when I get a chance in the next day or two I will. Thanks again.

Inigoesdr
08-14-2007, 12:34 AM
Thanks, but I have a question about this. I read somewhere it shouldn't be used on live production sites. What do I do download it and install it, and then when it works what do I do about the security problems with XAMPP?

It probably shouldn't be used on live production sites, but you aren't running a live production environment. You're using it for local development. :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum