ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:session:session_index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
v5:session:session_index [2023/03/23 18:09] – Remove NOTOC dregadv5:session:session_index [2023/03/27 13:14] – [MySQL or PDO MySQL] explain reason for using binary collation dregad
Line 148: Line 148:
  
 ==== MySQL or PDO MySQL ==== ==== MySQL or PDO MySQL ====
-   + 
-  CREATE TABLE sessions2( +<code> 
-   sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', +CREATE TABLE sessions2 ( 
-   expiry DATETIME NOT NULL , +  sesskey VARCHAR( 64 ) COLLATE utf8mb4_bin NOT NULL DEFAULT '', 
-   expireref VARCHAR( 250 ) DEFAULT '', +  expiry DATETIME NOT NULL , 
-   created DATETIME NOT NULL , +  expireref VARCHAR( 250 ) DEFAULT '', 
-   modified DATETIME NOT NULL , +  created DATETIME NOT NULL , 
-   sessdata LONGTEXT, +  modified DATETIME NOT NULL , 
-   PRIMARY KEY ( sesskey ) , +  sessdata LONGTEXT, 
-   INDEX sess2_expiry( expiry ), +  PRIMARY KEY ( sesskey ) , 
-   INDEX sess2_expireref( expireref ) +  INDEX sess2_expiry( expiry ), 
-  )+  INDEX sess2_expireref( expireref ) 
 +) 
 +</code> 
 + 
 +<WRAP info> 
 +When [[https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character|session.sid_bits_per_character]] php.ini setting is set to 6, the //Session ID// can contain both upper and lowercase letters.  
 +Collisions could occur in this case, due to MySQL performing case-insensitive searches by default.  
 +To avoid that, the //sesskey// column should use binary (or a case-sensitive) collation. 
 +</WRAP> 
  
 ==== PostgreSQL ==== ==== PostgreSQL ====
v5/session/session_index.txt · Last modified: 2023/04/08 18:08 by dregad