Contributed by jose on from the better-uptime dept.
There was a question in the queue on how to do this, good to see an answer came in.
(Comments are closed)
OpenBSD Journal
Contributed by jose on from the better-uptime dept.
There was a question in the queue on how to do this, good to see an answer came in.
(Comments are closed)
Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]
By Anonymous Coward () on
??????
Comments
By Anonymous Coward () on
By Fred Thompson () me@mymailserver.net on mymailserver.dyndns.org
By Anonymous Coward () on
Comments
By Eduardo Alvarenga () eduardo at thrx dot org on mailto:eduardo at thrx dot org
Comments
By Eduardo Alvarenga () eduardo at thrx dot org on mailto:eduardo at thrx dot org
Comments
By Jedi/Sector One () j@pureftpd.org on http://www.pureftpd.org
Of course because of the write concurrency you must use InnoDB, not MyISAM.
Here's the preloaded PHP script I'm using in order to share PHP sessions :
Can't connect to ' . htmlspecialchars($SESS_DBHOST) .
' as ' . htmlspecialchars($SESS_DBUSER) . '';
$error = mysql_error($SESS_DBH);
echo 'MySQL Error: ' . htmlspecialchars($error) . '';
@mysql_close($SESS_DBH);
die();
}
if (! mysql_select_db($SESS_DBNAME, $SESS_DBH))
{
echo 'Unable to select database ' .
htmlspecialchars($SESS_DBNAME) . '';
@mysql_close($SESS_DBH);
die();
}
return TRUE;
}
function sess_close()
{
global $SESS_DBH;
@mysql_close($SESS_DBH);
return TRUE;
}
function sess_read($key)
{
global $SESS_DBH;
$qry = 'SELECT `value` FROM `sessions` WHERE `sesskey` = ' .
'"' . $key . '" AND `expiry` > ' . time() . ' LIMIT 1';
if (($qid = mysql_query($qry, $SESS_DBH)) === FALSE) {
return FALSE;
}
list($value) = mysql_fetch_row($qid);
mysql_free_result($qid);
return $value;
}
function sess_write($key, $val)
{
global $SESS_DBH, $SESS_LIFE;
$expiry = time() + $SESS_LIFE;
if (strlen($value) > 1000000) {
@mail('patrice@orbus.fr','Session trop grande !',
"Session :nTaille :" . strlen($value));
}
$qry = 'REPLACE INTO `sessions` ' .
'(`sesskey`, `expiry`, `value`) VALUES (' .
'"' . $key . '", ' .
$expiry . ', ' .
'"' . mysql_real_escape_string($val,$SESS_DBH) . '"' .
')';
return mysql_unbuffered_query($qry, $SESS_DBH);
}
function sess_destroy($key)
{
global $SESS_DBH;
return mysql_unbuffered_query
('DELETE FROM `sessions` WHERE `sesskey` = "' . $key . '"',
$SESS_DBH);
}
function sess_gc($maxlifetime)
{
global $SESS_DBH;
@mysql_unbuffered_query
('DELETE FROM `sessions` WHERE `expiry`
and the schema :
+---------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+------------------+------+-----+---------+-------+
| sesskey | varchar(32) | | PRI | | |
| expiry | int(11) unsigned | | | 0 | |
| value | longtext | | | | |
+---------+------------------+------+-----+---------+-------+
In your php.ini, add :
auto_prepend_file = '/path/to/the/previous/script.php'
Comments
By Anonymous Coward () on
Drop me a mail if you need the whole script :)
By Anonymous Coward () on
Comments
By Anonymous Coward () on
By Stuart () on
The pf 'rdr' loadbalancing methods can be nicely augmented by using carp-protected addresses as the destinations to provide resilience (and of course the loadbalancer itself can be protected by carp+pfsync).
Comments
By Anonymous Coward () on
Pound is ghey!
Comments
By Anonymous Coward () on
In parantheses: if you use or trust REMOTE_ADDR for ANYTHING at all you don't need OpenBSD - Windows will do nicely for you ;-)
By Anonymous Coward () on
By Alejandro Belluscio () baldusi@hotmail.com on mailto:baldusi@hotmail.com
Comments
By Eduardo Alvarenga () eduardo at thrx dot org on mailto:eduardo at thrx dot org
By Fred Thompson () me@mymailserver.net on http://mymailserver.dyndns.org
By Ray () on
Comments
By cAPTAIN^k () on
http://www.openbsd.org/faq/pf/pools.html#incoming
By Fred Thompson () me@mymailserver.net on mymailserver.dyndns.org
By Fred Thompson () me@mymailserver.net on http://mymailserver.dyndns.org
By Tom Helmer Hansen (80.62.63.110) on