Login script works on test server but not on Dreamhost

Hi folks,

I created a login page for my site which works fine on my test server (WAMP 3.2) running MySql and PHP. When I transefer the files (connection script and login page) to my Dreamhost server nothing seems to happen when I submit the form. I don’t even know where to begin troubleshooting it as I am not getting any errors, just “nothing”.

I am not sure where the difference between my test server and Dreamhost is. I am running the same PHP version on both and I made sure that I changed the HOST and PORT on my connection script before uploading. Here is my script in case anyone sees something I missed:

-------------------------------------BEGIN CODE----------------------------------------
Connection Script:


//$hostname_conn_lcp = "localhost";
$hostname_conn_lcp = "my.dreamhost.sql.hostname";
$username_conn_lcp = "username";
$password_conn_lcp = "password";
$database_conn_lcp = "db_name";
$port_conn_lcp = "3306";

$conn_lcp = mysqli_connect($hostname_conn_lcp, $username_conn_lcp, $password_conn_lcp, $database_conn_lcp, $port_conn_lcp);

// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();


Login Script:

<?php require_once('Connections/conn_lcp.php'); ?>


// *** Validate request to login to this site.
if (!isset($_SESSION)) {

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];

if (isset($_POST['userName'])) {

  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "parent-pages/parents-lcpwaxhaw.php";
  $MM_redirectLoginFailed = "portal-login.php?status=loginfailure";
  $MM_redirecttoReferrer = false;

  mysqli_select_db($conn_lcp, $database_conn_lcp);
  $LoginRS__query=sprintf("SELECT UserName, password FROM tblusers WHERE UserName='$loginUsername' AND password='$password'"); 

  $LoginRS = mysqli_query($conn_lcp, $LoginRS__query) or die(mysqli_error($conn_lcp));

  $loginFoundUser = mysqli_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
  if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;       

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];  
    header("Location: " . $MM_redirectLoginSuccess );
  else {
    header("Location: ". $MM_redirectLoginFailed );

----------------------------------END CODE-------------------------------

Thanks in advance for any help.

Best regards,

The DH servers are setup for production, so by default they don’t show PHP errors. Here’s the help article on viewing error for development:

Hi Chuck,

Thanks for your reply. I read the help article you recommended and accessed the logs as indicated. Unfortunately there are no errors being generated that I can see. I looked from the previous day as well and I didn’t see any errors either. I successfully replicated the issue on your server and I can see in the access log that page access but there were no php errors generated on the error log.

This makes sense because as far as I can see, there are no issues with my code. There are NO ERRORS generated when I run my code on my test server and the pages work as expected. My test environment is setup to the same specs as the Dreamhost server so I don’t know what the difference is.

If there is some requirement that I am overlooking with regard to my server connection script, I don’t see what that is as I have followed to the best of my ability the requirements from the Dreamhost knowledge base.

I am truly stumped and with no errors I don’t even know where to begin.


Hmm, you’re right that help page is fairly broken. You should be able to see errors in-page by setting display_errors in your script. Here’s an example with several errors:




The output will look like this:

Warning : readfile(I-Dont-Exist): failed to open stream: No such file or directory in /home/user/example.com/test.php on line 6

Fatal error : Uncaught Error: Call to undefined function NotDefinedFunction() in /home/user/example.com/test.php:8 Stack trace: #0 {main} thrown in /home/user/example.com/test.php on line 8

That was exactly what I needed!!! THANK YOU!

There were some errors generated by my login script
“Warning: session_start(): Cannot send session cache limiter - headers already sent…”

I am going to dig into it now and I will let you know how it goes.

Best regards,

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.