php-general Digest 23 Sep 2009 03:27:41 -0000 Issue 6353
Topics (messages 298257 through 298267):
session.gc_maxlifetime
298257 by: Tom Worster
298258 by: Ralph Deffke
298259 by: Ralph Deffke
298260 by: Tom Worster
298261 by: Ralph Deffke
Misusing The URLENCODE/DECODE() Functions
298262 by: Nitsan Bin-Nun
Basic of Basics
298263 by: Todd Dunning
298264 by: Robert Cummings
298265 by: Todd Dunning
298266 by: Robert Cummings
Testing "Broken Pipe" Recovery?
298267 by: Dee Ayy
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
i'm not 100% sure what the manual means when it says...
session.gc_maxlifetime integer
session.gc_maxlifetime specifies the number of seconds after which data will
be seen as 'garbage' and cleaned up. Garbage collection occurs during
session start.
what event exactly does the "after which" here refer to?
i'd like to think that it means that a session is eligible for gc no sooner
than session.gc_maxlifetime seconds after the most recent access (read or
write) to that session. but it seems dangerously presumptuous to assume that
this is the case.
what do you take it to mean?
--- End Message ---
--- Begin Message ---
Hi Tom,
i did find this in the bug reports, its pretty new and should be an answer.
http://news.php.net/php.doc.bugs/2653
[email protected]
"Tom Worster" <[email protected]> wrote in message
news:c6de9eee.12c8d%[email protected]...
> i'm not 100% sure what the manual means when it says...
>
> session.gc_maxlifetime integer
> session.gc_maxlifetime specifies the number of seconds after which data
will
> be seen as 'garbage' and cleaned up. Garbage collection occurs during
> session start.
>
> what event exactly does the "after which" here refer to?
>
> i'd like to think that it means that a session is eligible for gc no
sooner
> than session.gc_maxlifetime seconds after the most recent access (read or
> write) to that session. but it seems dangerously presumptuous to assume
that
> this is the case.
>
> what do you take it to mean?
>
>
--- End Message ---
--- Begin Message ---
I forgot to mention, that this doesn't mean, you can not read data after
this timeout or that a session does ALWAYS die after this timeout. I would
assume, that the server has to have a reason to run garbage clean up. If the
server is not running a clean up, I would expect the session would excist
longer for access.
[email protected]
"Tom Worster" <[email protected]> wrote in message
news:c6de9eee.12c8d%[email protected]...
> i'm not 100% sure what the manual means when it says...
>
> session.gc_maxlifetime integer
> session.gc_maxlifetime specifies the number of seconds after which data
will
> be seen as 'garbage' and cleaned up. Garbage collection occurs during
> session start.
>
> what event exactly does the "after which" here refer to?
>
> i'd like to think that it means that a session is eligible for gc no
sooner
> than session.gc_maxlifetime seconds after the most recent access (read or
> write) to that session. but it seems dangerously presumptuous to assume
that
> this is the case.
>
> what do you take it to mean?
>
>
--- End Message ---
--- Begin Message ---
thank you, Ralph!
i'm going to be bold and assume that tom at punkave dot com is right despite
that the report was discarded.
i got a complaint from a client about some users reporting being logged out
with rather short periods of inactivity. but session.gc_maxlifetime is set
to 6 hours so i don't think that's the source of the problem.
On 9/22/09 4:17 PM, "Ralph Deffke" <[email protected]> wrote:
> Hi Tom,
>
> i did find this in the bug reports, its pretty new and should be an answer.
>
> http://news.php.net/php.doc.bugs/2653
>
> [email protected]
>
>
> "Tom Worster" <[email protected]> wrote in message
> news:c6de9eee.12c8d%[email protected]...
>> i'm not 100% sure what the manual means when it says...
>>
>> session.gc_maxlifetime integer
>> session.gc_maxlifetime specifies the number of seconds after which data
> will
>> be seen as 'garbage' and cleaned up. Garbage collection occurs during
>> session start.
>>
>> what event exactly does the "after which" here refer to?
>>
>> i'd like to think that it means that a session is eligible for gc no
> sooner
>> than session.gc_maxlifetime seconds after the most recent access (read or
>> write) to that session. but it seems dangerously presumptuous to assume
> that
>> this is the case.
>>
>> what do you take it to mean?
>>
>>
>
>
--- End Message ---
--- Begin Message ---
Hi Tom,
in sometimes 2001 I did have incidences with those things, and as I remember
over the past years there where some trouble with operating systems and
stuff. This part is very deep inside the os. I would expect that this is
still to consider. I also would check, if this occurs on very busy/low
memory server.
If I would programm the garbage collection clean up part, and if the server
is about to run out of memory, I would kill sessions being longer time idle
even when they are not yet as old as it is set in the gc_maxlifetime. This
would be far better then shutting down the whole server just because there a
100 of idle sessions waiting to get used again.
as u mention a maxlivetime of 6h I would bet, that this is the problem. I
would not trust such a long lifetime at all.
If sessions have to be active such a long time, I would see only cooky based
solutions
let me know, what u did investigate on this.
[email protected]
"Tom Worster" <[email protected]> wrote in message
news:c6deae55.12cae%[email protected]...
> thank you, Ralph!
>
> i'm going to be bold and assume that tom at punkave dot com is right
despite
> that the report was discarded.
>
> i got a complaint from a client about some users reporting being logged
out
> with rather short periods of inactivity. but session.gc_maxlifetime is set
> to 6 hours so i don't think that's the source of the problem.
>
>
> On 9/22/09 4:17 PM, "Ralph Deffke" <[email protected]> wrote:
>
> > Hi Tom,
> >
> > i did find this in the bug reports, its pretty new and should be an
answer.
> >
> > http://news.php.net/php.doc.bugs/2653
> >
> > [email protected]
> >
> >
> > "Tom Worster" <[email protected]> wrote in message
> > news:c6de9eee.12c8d%[email protected]...
> >> i'm not 100% sure what the manual means when it says...
> >>
> >> session.gc_maxlifetime integer
> >> session.gc_maxlifetime specifies the number of seconds after which data
> > will
> >> be seen as 'garbage' and cleaned up. Garbage collection occurs during
> >> session start.
> >>
> >> what event exactly does the "after which" here refer to?
> >>
> >> i'd like to think that it means that a session is eligible for gc no
> > sooner
> >> than session.gc_maxlifetime seconds after the most recent access (read
or
> >> write) to that session. but it seems dangerously presumptuous to assume
> > that
> >> this is the case.
> >>
> >> what do you take it to mean?
> >>
> >>
> >
> >
>
>
--- End Message ---
--- Begin Message ---
Hi List
I usually don't tend to post here but I have no time and no idea :(
I'm using .htaccess and a php router file (based upon regex patterns) in
order to create google-friendly URL's
It works like a charm, but somehow it has decoding '+' signs and similar
things into the appropriate character
For instance, I'm trying to reach this page:
A%252bk/ASTROBEAM_S130.html
It's being parsed by the following regex pattern:
'bulb/(.+/.+)\.html' => 'index.php?a=lamp_by_model&model=$1',
The loaded page PHP content is:
list($make, $model) = parse_model_slug($_GET['model']);
The parse_model_slug() function:
function parse_model_slug($slug)
{
$r = explode("/", $slug);
$r[0] = str_replace("_", " ", $r[0]);
$r[1] = str_replace("_", " ", $r[1]);
var_dump($r);
die;
return array('make' => $r[0], 'model' => $r[1]);
}
The current output is:
A%252bk/ASTROBEAM_S130
array(2) {
[0]=>
string(7) "A%252bk"
[1]=>
string(14) "ASTROBEAM S130"
}
Then whenever I add urldecode() to the function:
function parse_model_slug($slug)
{
$r = explode("/", $slug);
$r[0] = str_replace("_", " ", urldecode($r[0]));
$r[1] = str_replace("_", " ", urldecode($r[1]));
var_dump($r);
die;
return array('make' => $r[0], 'model' => $r[1]);
}
A%252bk/ASTROBEAM_S130array(2) {
[0]=>
string(5) "A%2bk"
[1]=>
string(14) "ASTROBEAM S130"
}
I have no idea how to parse this string right.
Any help would be highly appreciated!!
--
Nitsan
--- End Message ---
--- Begin Message ---
Just put yourself in these shoes:
1. It's before you learned SQL.
2. You can declare variables and call includes and that's about it.
3. Your site looks great, the includes are ready. The variables are already
in the includes.
4. You have a delimited file, 15K rows, 30 columns.
5. You have to get it done tonight.
6. Your entire career has been spent using static files, but now it's time
to grow up.
Here's the challenge for you, Mr. Pre-SQL:
1. You need the usual search results, say about 20 rows, and the result
page. The most basic of basics.
2. Thank the gurus at php.general.
--- End Message ---
--- Begin Message ---
Todd Dunning wrote:
Just put yourself in these shoes:
1. It's before you learned SQL.
2. You can declare variables and call includes and that's about it.
3. Your site looks great, the includes are ready. The variables are already
in the includes.
4. You have a delimited file, 15K rows, 30 columns.
5. You have to get it done tonight.
6. Your entire career has been spent using static files, but now it's time
to grow up.
Here's the challenge for you, Mr. Pre-SQL:
1. You need the usual search results, say about 20 rows, and the result
page. The most basic of basics.
2. Thank the gurus at php.general.
There's a link out there somewhere about posting well formed questions.
The above, if it is a question (I don't see any question marks), does
not in any way adhere to the principles of a well formed question.
The existence of 5 suggests that 6 should have happened already.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
Rob it's LAMP php5. Godaddy virtual dedicated. I'm considering if I should
just bite the bullet and attempt to build my first SQL db tonight, because
there's plenty of info about doing the basics via sql. I have phpMyAdmin
and cPanel. It's a classic noob issue of whether to spend extra time doing
it the right way or not.
Thanks very much for your interest in helping.
----- Original Message -----
From: "Robert Cummings" <[email protected]>
To: "Todd Dunning" <[email protected]>
Cc: <[email protected]>
Sent: Tuesday, September 22, 2009 5:22 PM
Subject: Re: [PHP] Basic of Basics
Todd Dunning wrote:
Just put yourself in these shoes:
1. It's before you learned SQL.
2. You can declare variables and call includes and that's about it.
3. Your site looks great, the includes are ready. The variables are
already in the includes.
4. You have a delimited file, 15K rows, 30 columns.
5. You have to get it done tonight.
6. Your entire career has been spent using static files, but now it's
time to grow up.
Here's the challenge for you, Mr. Pre-SQL:
1. You need the usual search results, say about 20 rows, and the result
page. The most basic of basics.
2. Thank the gurus at php.general.
There's a link out there somewhere about posting well formed questions.
The above, if it is a question (I don't see any question marks), does not
in any way adhere to the principles of a well formed question.
The existence of 5 suggests that 6 should have happened already.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
Todd Dunning wrote:
Rob it's LAMP php5. Godaddy virtual dedicated. I'm considering if I should
just bite the bullet and attempt to build my first SQL db tonight, because
there's plenty of info about doing the basics via sql. I have phpMyAdmin
and cPanel. It's a classic noob issue of whether to spend extra time doing
it the right way or not.
Thanks very much for your interest in helping.
The following will do it without a database:
<?php
$file = 'your-file.csv';
$keywords = 'keyword1 keyword2 ...';
$keywords = preg_split( '# +#', $keywords );
$clauses = array();
foreach( $keywords as $keyword )
{
if( ($keyword = trim( (string)$keyword )) === '' )
{
continue;
}
$keyword = escapeShellArg( $keyword );
$clauses[] = "grep -s -i -F $keyword";
}
$matches = '';
if( $clauses )
{
$file = escapeShellArg( $file );
$command = "cat $file | ".implode( " | ", $clauses );
$matches = `$command`;
}
echo $matches."\n";
?>
You still need to parse your feed afterwards which I presumed was a CSV
or tab delimited style file WITHOUT newlines.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
How do I intentionally break a pipe so that I can test recovering
under this eventuality?
I saw this post "[PHP] Pushing the limits of stream_socket_server()
and stream_select()" but my intermittent broken pipe occurs with 1
client, so I don't want to to create a 252 client situation.
I'm actually testing a client against a remote 3rd party server. I
was thinking of creating my own server; connect my client to that; and
maybe just killing my server process while it's connected (rather than
using fclose which may be too clean). Is that the right approach?
--- End Message ---