Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9223693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:07:58+00:00 2026-06-18T04:07:58+00:00

Another Update! 2/2/13 Updated PHP to version 5.3 and it now gives me this

  • 0

Another Update! 2/2/13
Updated PHP to version 5.3 and it now gives me this message,

Fatal error: Uncaught exception ‘PDOException’ with message ‘You cannot serialize or unserialize PDO instances’ in [no active file]:0 Stack trace: #0 [internal function]: PDO->__sleep() #1 {main} thrown in [no active file] on line 0

However, I’m not using the serialize or unserialize function…

Update!

This works, but it is the incorrect and ugliest way of doing it. And I don’t want to do it like this, but I figured that it might help

$db    = new PDO("mysql:host=127.0.0.1;dbname=dbname;", "user", "pass");
public function login($user, $pass) {
    global $db;
    //stuff
}

ORIGINAL POST

I just switched over my project files to my web host (it works perfectly locally).

I’m getting this error, Fatal error: Exception thrown without a stack frame in Unknown on line 0.

It is oh so helpful. I am only including one file right now, it’s a class with one function which counts the IDs of the entered username and password and then either returns true or false depending on what it found. (1 = true, anything but 1 = false).

I’m using PDO (mysql), and if I don’t connect to my database I don’t get the error but if I remove the session_start(); from the top of my document I also don’t get the error.
private $db;

public function __construct() {
    $this->db = new PDO("mysql:host=127.0.0.1;dbname=dbname;", "user", "pass");
    $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}

And this is where I set the session,

if(isset($_POST["submit"])) {
    $errors = array();
    if($user->login($_POST["user"], $_POST["pass"]) === false) {
        $errors[] = "Username or password is incorrect";
    }
    if(empty($errors)) {
        $_SESSION["user"] = $_POST["user"];
        header("Location: index.php");
    }
}

I am not actually throwing an exception, anywhere. I don’t know what this error means. I am running PHP Version 5.2.17

Here is my login function,

public function login($user, $pass) {
    $sql = $this->db->prepare("SELECT COUNT(`id`) FROM `users` WHERE `username` = :user AND `password` = :pass");
    $sql->bindParam(":user", $user);
    $sql->bindParam(":pass", $pass);
    $sql->execute();

    return ($sql->fetchColumn() == 1) ? true : false;
}

Index page (error occurs on every page that uses session_start, index page and login page)

session_start();
if(!isset($_SESSION["user"])) {
    header("Location: login.php");
}else {
    //begin HTML, no more php after this (except the closing bracket)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:07:59+00:00Added an answer on June 18, 2026 at 4:07 am

    I renamed the session to “username” instead of “user” and then it started working. I called my user class for $user so I guess something went terribly wrong when I tried to name a session the same. Which is still terribly weird because $user is a variable and “user” is a string >_>

    Anyways, problem has been resolved, thank you PHP for being rather dumb sometimes.

    Update

    The culprit this entire time was register_globals in the PHP.ini. It was turned off on my local server but it was turned on, on my host.

    It’s turned off now though, everywhere. I thought I might add this in case some runs into this problem in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Copied a working website from one server to another, now I'm getting this error
What is the best way to communicate with another process in PHP? Update: Using
Does this mean I can't update another table from a trigger if I'm using
I have this function to create a request to another file to update the
I try to update a table using another table. I get the error number
I have this ajax_update script that updates file.php every 60 seconds.. Now file.php outputs
I am trying to create a trigger to update another table with a condition
I want to update a Object in another thread, and then access it in
I am trying to update a label from one form to another. the code
I need to use scp update some directory at another server. It is similar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.