We help IT Professionals succeed at work.
Get Started

PHP login as Singleton design pattern

Last Modified: 2012-05-12

I have a PHP login class set up with the Singleton design pattern. I'm wondering if I have multiple users logging and updating using this class will I encounter any problems with number of connections (since it's a Singleton design pattern).

Should I create a PHP login system with a Registry Pattern instead. I noticed that one limitation I had with the Singleton design pattern is that I set the database in it and so for a user to use another database then I had to create another instance of the connection.

I'm wondering if using mysqli is more efficient than PDO. I coded it with PDO. Mysqli has the function to end the connection. I don't know how PDO handles it though. Right now I don't have a lot of users but I want to be able use my login code that will scale well.


I guess in a related way the number of MySQL connections is set in my.conf but I'm not certain. Any suggestions? How would I test that my class can handle x number of users of logins?

Watch Question
This problem has been solved!
Unlock 4 Answers and 9 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE