I am running Apache 2 on a Mac using OS X 10.5. I have created a web page with a form to allow users to enter a username and password. If I display this page in a browser there is no problem. However, when I add the Log In User behaviour the page will not be displayed in the browser. I have not modified the code generated by Dreamweaver at all. I raised a question on the Adobe forum and they told me there that the code was ok and that the problem is in my Apache installation! This is a bit confusing as Apache comes pre-installed on a Mac! The error message I get in the browser is: Safari can't open the page "http://site.co.uk/login.php". The error was: "cannot parse response" (NSURLErrorDomain:-1017). The error_log shows: [notice] child pid 46740 exit signal Bus error (10) Anyway, I have no problem viewing pages on my server that are plain html or that contain php code. However, the log in user behaviour adds code that works with sessions and I'm afraid that is causing the problem. Here's the code: <?php virtual('/~user/site/Connections/connSite.php'); ?> <?php if (!function_exists("GetSQLValueString")) {function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['username'])) { $loginUsername=$_POST['username']; $password=$_POST['passwrd']; $MM_fldUserAuthorization = "username"; $MM_redirectLoginSuccess = "/~user/Site/admin.php"; $MM_redirectLoginFailed = "/~user/Site/valerror.html"; $MM_redirecttoReferrer = true; mysql_select_db($database_connSite, $connSite); $LoginRS__query=sprintf("SELECT username, password, username FROM Users WHERE username=%s AND password=%s", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $connSite) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = mysql_result($LoginRS,0,'username'); //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && true) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Site.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title></title> <!-- InstanceEndEditable --> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> <link href="/~user/Site/Site.css" rel="stylesheet" type="text/css" /> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> </head> <body> <div id="container"> <div id="top"> <h1 align="left"><span class="title"> </span> <noscript> </noscript> <span class="title"> <noscript> </noscript> </span> <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','439','height','154','src','/~user/Site/Multimedia/Rainbow','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','/~user/Site/Multimedia/Rainbow' ); //end AC code </script><noscript><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="439" height="154"> <param name="movie" value="/~user/Site/Multimedia/Rainbow.swf" /> <param name="quality" value="high" /> <embed src="/~user/Site/Multimedia/Rainbow.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="439" height="154"></embed> </object></noscript> </h1> <p class="subtitle">www.Site.co.uk</br> </p> </div> <div id="navbar"> <ul id="MenuBar1" class="MenuBarHorizontal"> <li><a href="/~user/Site/index.html">Home</a> </li> <li><a href="/about.html">About us</a></li> <li><a href="#" class="MenuBarItemSubmenu">Treatments</a> <ul> <li><a href="/~user/Site/face.php">face</a></li> <li><a href="/~user/Site/body.php">body</a></li> <li><a href="/~user/Site/men.php">for men</a></li> <li><a href="/~user/Site/hands.php">hands and feet</a></li> <li><a href="/~user/Site/nails.php">nails</a></li> <li><a href="/~user/Site/eyes.php">eyes</a></li> <li><a href="/~user/Site/waxing.php">waxing</a></li> <li><a href="/~user/Site/electrolysis.php">electrolysis</a></li> <li><a href="/~user/Site/makeup.php">make up</a></li> <li><a href="/~user/Site/packages.php">special packages</a></li> </ul> </li> <li><a href="/pricelist.php">Price list</a></li> <li><a href="/contact.html">Contact us</a></li> <li><a href="/admin.php" class="MenuBarItemSubmenu">Admin</a> <ul> <li><a href="/login.php">Login</a></li> <li><a href="/useradmin.php">Users</a></li> <li><a href="/therapyadmin.php">Treatments</a></li> </ul> </li> <p> </p> </ul> </div> <div id="content"><!-- InstanceBeginEditable name="content" --> <form ACTION="<?php echo $loginFormAction; ?>" METHOD="POST" name="login" id="login"> <p class="infotext">Enter your user name and password.</p> <table border="1" cellspacing="4" cellpadding="4"> <tr> <td class="infotext">User name:</td> <td><label><input type="text" name="username" /></label></td> </tr> <tr> <td class="infotext">Password:</td> <td><label><input type="text" name="passwrd" /></label></td> </tr> <tr> <td colspan="2"><label><input type="submit" value="login" /></label></td> </tr> </table> </form> <!-- InstanceEndEditable --></div> <div class="class" id="footer"> <div align="center"> <p>© Site 2007</p> </div> </div> </div> </div> <script type="text/javascript"> <!-- var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"/SpryAssets/SpryMenuBarDownHover.gif", imgRight:"/SpryAssets/SpryMenuBarRightHover.gif"}); //--> </script> </body> <!-- InstanceEnd --></html>
This is a shot in the dark, but could there be a problem with the Apache process (not sure now it works on Mac) not having proper access permissions for the directory PHP session data is stored ?