LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2006, 01:33 PM   #1
tonyl
LQ Newbie
 
Registered: Jul 2006
Posts: 3

Rep: Reputation: 0
Can not save PHP session in MySQL


HI:

I have a user login system written in PHP. it is designed to save sessions in MySQL for sercurity reason. The script was running fine on a Windows XP machine with PHP 5.1.4. However, when I moved the system to a Redhat 9 machine, it won't write to MySQL. I thought maybe the PHP 4.0 on Redhat 9 is too old. So I installed Fedora 5 core, with lastest PHP 5, still it won't work. I have set "session.save_handler users" in php.ini. and I also followed instructions posted on shiflett.org/articles/guru-speak-jan2005
to define new session_set_save_handler(). My php MySQL module seems working since I have been using phpMyAdmin to manipulate MySQL without problem...

I do not know what could be wrong at this stage. Could any expert advise what other things/aspects I should check?

Many thanks,

Tony
 
Old 08-02-2006, 12:51 AM   #2
pddm
Member
 
Registered: Sep 2005
Distribution: Mint 19.2
Posts: 112

Rep: Reputation: 15
You are starting again a new thread for the same question!

I sent you a reply on the previous:
http://www.linuxquestions.org/questi...d.php?t=469442

The Administrators do not like duplicate threads.
 
Old 08-02-2006, 08:05 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
True. And session-saving in SQL is something that you can fairly easily find on the many PHP-oriented archives.

There have been issues with various versions of PHP, against various versions of SQL servers. For example the data can become quite large (it can overflow PHP's undocumented limits too). But there are various ways that you can handle that. PHP's built-in session facilities are convenient, but by no means the only way to handle state-information. In a "secure" application, furthermore, this implementation (even if hitting an SQL server for its back-end data store) might not be appropriate. It's not too hard to trick PHP into dumping its brain to the client screen.

All you can really do is to watch what's going to the SQL table and also watch what might be dumped to the Apache log. And, you know, just debug your code...
 
Old 08-03-2006, 02:39 AM   #4
smallville
Member
 
Registered: Dec 2005
Posts: 44

Rep: Reputation: 15
can you show us your sample code on saving the session. the error might be in your code....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP & MYSQL => session object using db link resource ldp Programming 2 03-19-2005 02:38 AM
xfce4-session fails to save session ! OneManArmy Debian 0 12-10-2004 02:14 PM
MySQL/PHP/Horde "Failed to write session data" Big Money Linux - Software 0 11-23-2004 01:33 PM
How to save a session? jpan Debian 3 09-28-2004 03:26 AM
Your chance to save MySQL / PHP from ASP.NET ! Bert Linux - Software 11 07-13-2002 05:55 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration