php-general Digest 3 Sep 2008 15:03:24 -0000 Issue 5661

Topics (messages 279370 through 279398):

Re: Recommendation
        279370 by: Eric Butera
        279371 by: Shawn McKenzie
        279382 by: Jason Pruim
        279384 by: Jochem Maas
        279387 by: Dan Joseph

Re: Mulitiple Arrary Sort
        279372 by: Jim Lucas
        279383 by: Diogo Neves

Re: Google Chrome
        279373 by: Per Jessen
        279377 by: Jochem Maas
        279378 by: Lester Caine
        279379 by: Colin Guthrie
        279380 by: Luke
        279381 by: Richard Heyes
        279398 by: Nathan Nobbe

Re: Individual bulk e-mails - performance question (was "skinning a cat") :-)
        279374 by: Micah Gersten
        279376 by: Robert Cummings

Re: Using DOM textContent Property
        279375 by: Lupus Michaelis

need to display a number of items based on browser size, before i get to run 
any js
        279385 by: Rene Veerman
        279386 by: Jay Blanchard

PHP on 64bit Ubuntu
        279388 by: alexander lind
        279390 by: Per Jessen
        279391 by: Hélio Rocha
        279392 by: Robert Cummings
        279393 by: Robert Cummings
        279394 by: Robert Cummings
        279395 by: alexander lind
        279396 by: alexander lind
        279397 by: Aschwin Wesselius

Re: Secure way to handle pw on session.
        279389 by: k bah

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 ---
On Tue, Sep 2, 2008 at 7:55 PM, Dan Joseph <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 2, 2008 at 3:08 PM, Jay Blanchard <[EMAIL PROTECTED]> wrote:
>
>> [snip]
>> ...
>> [/snip]
>>
>> Who is going to create the group?
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> Well, I guess if no one is volunteering, I can create it, but I think it
> should be a community chosen name.  Suggestions?
>
> --
> -Dan Joseph
>
> www.canishosting.com - Plans start @ $1.99/month.
>
> "Build a man a fire, and he will be warm for the rest of the day.
> Light a man on fire, and will be warm for the rest of his life."
>

php-general

--- End Message ---
--- Begin Message ---
Dan Joseph wrote:
What about also creating a PHP General List group?  Has anyone created
Groups on linkedin before?  Maybe we could get quite a few people "linked"
thru one?


Well, if you go to groups, groups directory here are already quite a few PHP groups. That's why I haven't joined one. I was hoping to find an "official" group or one that is large with most PHP coders, but there are so many already.

Is the purpose for just this list? If so then by all means create a new one.

-Shawn

--- End Message ---
--- Begin Message ---

On Sep 2, 2008, at 3:08 PM, Jay Blanchard wrote:

[snip]
...
[/snip]

Who is going to create the group?

just a quick search of groups on linked in showed 134 groups related to "php".


And my profile: http://www.linkedin.com/pub/9/59a/b41

:)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





--- End Message ---
--- Begin Message ---
Jason Pruim schreef:

On Sep 2, 2008, at 3:08 PM, Jay Blanchard wrote:

[snip]
...
[/snip]

Who is going to create the group?

just a quick search of groups on linked in showed 134 groups related to "php".


And my profile: http://www.linkedin.com/pub/9/59a/b41

:)


and the guy that started this thread just seemed to drop off the planet,
very strange.


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]







--- End Message ---
--- Begin Message ---
On Wed, Sep 3, 2008 at 6:29 AM, Jason Pruim <[EMAIL PROTECTED]> wrote:

>
> On Sep 2, 2008, at 3:08 PM, Jay Blanchard wrote:
>
>  [snip]
>> ...
>> [/snip]
>>
>> Who is going to create the group?
>>
>
> just a quick search of groups on linked in showed 134 groups related to
> "php".
>
>
> And my profile: http://www.linkedin.com/pub/9/59a/b41
>
> :)
>
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 11287 James St
> Holland, MI 49424
> www.raoset.com
> [EMAIL PROTECTED]
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Well there definitely is a lot of PHP groups.  In that case, maybe someone
that oversees the PHP list should create one that is associated to this one.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

--- End Message ---
--- Begin Message ---
Vernon wrote:
I've gotten the one array down and I've figured out how to sort that array, however, I need to sort the array by the modified date of the file. Here's what I got so far:

<?php
// Open current directory
if($handle = opendir($dir)){
// Loop through all files
while(false !== ($file = readdir($handle))){
// Ignore hidden files
if(!preg_match("/^\./", $file)){
// Put dirs in $dirs[] and files in $files[]
if(is_dir($file)){
$dirs[] = $file;
}else{
$files[] = $file;
}
}
}

// Close directory
closedir($handle);


// if $files[] exists, sort it and print all elements in it.
if(is_array($files)){
//HERE IS MY CURRENT SORT WHICH I KNOW I NEED TO CHANGE BUT AM UNSURE HOW
sort($files);
foreach($files as $file){
$completeFileName = $dir . $file;
//I WANT TO SORT BY THIS
echo date("m-d-Y", filemtime($completeFileName)) . "<br>";
}
}

}
?>

Any ideas on how to fix this? Thanks


We need to see what is in the array, not just how you think you need to 
manipulate it.

Show us the basic structure of the array, with a few examples of data that would represent what you would normally be building the table out of.

Then, with that, we might be able to start helping you.

--- End Message ---
--- Begin Message ---
On Wed, Sep 3, 2008 at 12:35 AM, Vernon <[EMAIL PROTECTED]> wrote:

> I've gotten the one array down and I've figured out how to sort that array,
> however, I need to sort the array by the modified date of the file. Here's
> what I got so far:
>
> <?php
> // Open current directory
> if($handle = opendir($dir)){
> // Loop through all files
> while(false !== ($file = readdir($handle))){
> // Ignore hidden files
> if(!preg_match("/^\./", $file)){
> // Put dirs in $dirs[] and files in $files[]
> if(is_dir($file)){
> $dirs[] = $file;
> }else{
> $files[] = $file;
> }
> }
> }
>
> // Close directory
> closedir($handle);
>
>
> // if $files[] exists, sort it and print all elements in it.
> if(is_array($files)){
> //HERE IS MY CURRENT SORT WHICH I KNOW I NEED TO CHANGE BUT AM UNSURE HOW
> sort($files);
> foreach($files as $file){
> $completeFileName = $dir . $file;
> //I WANT TO SORT BY THIS
> echo date("m-d-Y", filemtime($completeFileName)) . "<br>";
> }
> }
>
> }
> ?>
>
> Any ideas on how to fix this? Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Hi,

<?php
$dir        = '/tmp';
$files        = scandir( $dir);
$files_new    = array( );

foreach( $files as $file ) {
    if( strrpos( $file, 'sess_' ) !== false ) {
        $files_new[filemtime( $dir . '/' . $file )] = $file;
    }
}

ksort( $files_new );
$filesnew    = array( );

foreach( $files_new as $key => $file ) {
    $filesnew[] = $file;
}

var_dump( $filesnew );
?>

It should work for you with small changes ;)


-- 
Thanks for your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

--- End Message ---
--- Begin Message ---
Stut wrote:

> On 2 Sep 2008, at 20:23, Diogo Neves wrote:
>> Now is the time ;)
> 
> Indeed: http://www.google.com/chrome
> 
> But only for Windows for now :(
> 

I guess we'll have to wait a little longer then ...


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Haig Dedeyan schreef:
On September 2, 2008 05:56:23 pm Haig Dedeyan wrote:

Does anyone know what this implies? It's the 2nd section from their license agreement:

"By submitting, posting or displaying the content you give Google a perpetual, irrevocable, worldwide, royalty-free, and non-exclusive license to reproduce, adapt, modify, translate, publish, publicly perform, publicly display and distribute any content which you submit, post or display on or through, the services. This license is for the sole purpose of enabling Google to display, distribute and promote the services and may be revoked for certain services as defined in the additional terms of those services."

scary ... but what's this context of this section (I'm on MacOS .. still waiting
for a beta ;-)) ... more precisely what's the definition of "the content"
and "the services".

I can't imagine the browser can be considered a service by any means.


Haig


Mouse wheel works fine for me.

----- Original Message -----
From: "Douglas Temple" <[EMAIL PROTECTED]>
To: "Robert Cummings" <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Date: Tue, 2 Sep 2008 21:04:30 +0100
Subject: Re: [PHP] Google Chrome

Beta or not, it's still amazingly fast.
Despite the fact you can't scroll up with the mouse wheel...





--- End Message ---
--- Begin Message ---
Jochem Maas wrote:
Haig Dedeyan schreef:
On September 2, 2008 05:56:23 pm Haig Dedeyan wrote:

Does anyone know what this implies? It's the 2nd section from their license agreement:

"By submitting, posting or displaying the content you give Google a perpetual, irrevocable, worldwide, royalty-free, and non-exclusive license to reproduce, adapt, modify, translate, publish, publicly perform, publicly display and distribute any content which you submit, post or display on or through, the services. This license is for the sole purpose of enabling Google to display, distribute and promote the services and may be revoked for certain services as defined in the additional terms of those services."

scary ... but what's this context of this section (I'm on MacOS .. still waiting
for a beta ;-)) ... more precisely what's the definition of "the content"
and "the services".

I can't imagine the browser can be considered a service by any means.

Some sections seems to imply that you HAVE to be connected to Google even to use the browser? And that they reserve the right to stop you browsing if they need to? Can anybody confirm that I will be able to use the browser off line on a closed network, since that would be the environment *I* would be testing anything new in :)
At present I don't feel able to accept their terms at all?

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
Dan Joseph wrote:
Well its not that exciting I guess.  All the hype, and its a browser. :)  It
is fast though, I'll give it that.

I think most of the kudos points for speed here are due to the WebKit team of KDE/Qt/Trolltech and Apple + others.

Col



--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--- End Message ---
--- Begin Message ---
yes but this would be the first time we see this kind of speed on a Windows
browser. Apple didn't pull it off too well.

2008/9/3 Colin Guthrie <[EMAIL PROTECTED]>

> Dan Joseph wrote:
>
>> Well its not that exciting I guess.  All the hype, and its a browser. :)
>>  It
>> is fast though, I'll give it that.
>>
>
> I think most of the kudos points for speed here are due to the WebKit team
> of KDE/Qt/Trolltech and Apple + others.
>
> Col
>
>
>
> --
>
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
>
> Day Job:
>  Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>  Mandriva Linux Contributor [http://www.mandriva.com/]
>  PulseAudio Hacker [http://www.pulseaudio.org/]
>  Trac Hacker [http://trac.edgewall.org/]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater

--- End Message ---
--- Begin Message ---
> Tomorrow I think...

And now tomorrow has arrived and I've downloaded it, I think it looks
quite good. Perhaps unsurprisingly from Google, it's rather fast.
Thankfully, it appears to support my (HTML5) RGraph thang.  I do
wonder, when will Google bring out the Google levitation device...?

If anyone is interested I've already updated my browser detection thang for it.

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Opera and Safari:
http://www.phpguru.org/RGraph

--- End Message ---
--- Begin Message ---
On Wed, Sep 3, 2008 at 2:29 AM, Colin Guthrie <[EMAIL PROTECTED]> wrote:

> Dan Joseph wrote:
>
>> Well its not that exciting I guess.  All the hype, and its a browser. :)
>>  It
>> is fast though, I'll give it that.
>>
>
> I think most of the kudos points for speed here are due to the WebKit team
> of KDE/Qt/Trolltech and Apple + others.


bigtime.

-nathan

--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
> On Mon, 2008-09-01 at 14:34 +0200, Merlin Morgenstern wrote:
>   
>> Per Jessen schrieb:
>>     
>>> Jochem Maas wrote:
>>>
>>>       
>>>>> lockfile=/var/lock/<xxxx>/file
>>>>> # clear out a lock older than 60mins
>>>>> find $lockfile -cmin +60 | xargs rm
>>>>> test ! -f $lockfile && (
>>>>> touch $lockfile
>>>>> <run some php>
>>>>> rm -f $lockfile
>>>>> )
>>>>>           
>>>> wouldn't creating a dir be better here? (with regard to atomicity)
>>>>
>>>>         
>>> I haven't thought it through, but I don't think it would change
>>> anything. 
>>>
>>>
>>> /Per Jessen, Zürich
>>>
>>>       
>> Hello everybody,
>>
>> thank you for the huge amount of replies on my question. I believe I 
>> quite lost a bit track on how to solve the problem hands on. To 
>> summerize, there are aparently two ways of skinning the cat :-)
>>
>> 1. Run a deamon
>> I admit I have never wrote one, and that seems therefore to be the 
>> harder option for me. Well... perhaps not.
>> I assume it is simply creating a shell script like Jochem wrote, however 
>>     I guess it would just take longer for me to get it running as I have 
>> never done that before.
>>
>> 2. Create a PHP file that holds some lock code which is triggered by 
>> CRON every 5 minutes. Taking the example from Robert.
>>
>> 3. Following idea which I am now actually implementing :-)
>>
>>   - Add all emails into a mysql db with one insert command.
>>   - Run a php script by cron every 5 min that does the following:
>>      - update table, set session_id = x on all entries without session id
>>      - get all entries with that session ID
>>      - send email to those with that session ID
>>      - remove all entries with that session ID
>>
>> Looks like easies sollution on how to skimm the cat. DB might not be the 
>> most performing sollution, but sufficient considering the hard ware power.
>>     
>
> Actually 3 was what I suggested with a lock mechanism to ensure that if
> your script run by cron takes longer than 5 minutes that you don't have
> two scritps stepping on each others' toes.
>
> Cheers,
> Rob.
>   
He solves that by adding the session ID at the beginning of the script
and only operating on those entries.  The scripts might be running
simultaneously, but will not step on each other's toes.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


--- End Message ---
--- Begin Message ---
On Wed, 2008-09-03 at 00:55 -0500, Micah Gersten wrote:
> Robert Cummings wrote:
> > On Mon, 2008-09-01 at 14:34 +0200, Merlin Morgenstern wrote:
> >   
> >> Per Jessen schrieb:
> >>     
> >>> Jochem Maas wrote:
> >>>
> >>>       
> >>>>> lockfile=/var/lock/<xxxx>/file
> >>>>> # clear out a lock older than 60mins
> >>>>> find $lockfile -cmin +60 | xargs rm
> >>>>> test ! -f $lockfile && (
> >>>>> touch $lockfile
> >>>>> <run some php>
> >>>>> rm -f $lockfile
> >>>>> )
> >>>>>           
> >>>> wouldn't creating a dir be better here? (with regard to atomicity)
> >>>>
> >>>>         
> >>> I haven't thought it through, but I don't think it would change
> >>> anything. 
> >>>
> >>>
> >>> /Per Jessen, Zürich
> >>>
> >>>       
> >> Hello everybody,
> >>
> >> thank you for the huge amount of replies on my question. I believe I 
> >> quite lost a bit track on how to solve the problem hands on. To 
> >> summerize, there are aparently two ways of skinning the cat :-)
> >>
> >> 1. Run a deamon
> >> I admit I have never wrote one, and that seems therefore to be the 
> >> harder option for me. Well... perhaps not.
> >> I assume it is simply creating a shell script like Jochem wrote, however 
> >>     I guess it would just take longer for me to get it running as I have 
> >> never done that before.
> >>
> >> 2. Create a PHP file that holds some lock code which is triggered by 
> >> CRON every 5 minutes. Taking the example from Robert.
> >>
> >> 3. Following idea which I am now actually implementing :-)
> >>
> >>   - Add all emails into a mysql db with one insert command.
> >>   - Run a php script by cron every 5 min that does the following:
> >>    - update table, set session_id = x on all entries without session id
> >>    - get all entries with that session ID
> >>    - send email to those with that session ID
> >>    - remove all entries with that session ID
> >>
> >> Looks like easies sollution on how to skimm the cat. DB might not be the 
> >> most performing sollution, but sufficient considering the hard ware power.
> >>     
> >
> > Actually 3 was what I suggested with a lock mechanism to ensure that if
> > your script run by cron takes longer than 5 minutes that you don't have
> > two scritps stepping on each others' toes.
> >
> > Cheers,
> > Rob.
> >   
> He solves that by adding the session ID at the beginning of the script
> and only operating on those entries.  The scripts might be running
> simultaneously, but will not step on each other's toes.

Ahh, I didn't notice he added extra details. Oh well... unless he locks
the table then he's still got race conditions to face. But i guess
they're unlikely to be an issue given that there's 5 minutes between one
run and the next. The other problem is if the system were to grind to a
halt because cron2 fires before cron1 finishes, and cron3 fires before
cron1 and cron2 finish, and cron4... well you get the picture. With a
single cron script in execution at any given time you can be sure that
not everyone is trying to squeeze throught he door at the same time.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Tim Gustafson a écrit :

$Elements = $HTML->getElementsByTagName("*");

for ($X = 0; $X < $Elements->length; $X++) {
  ... SNIP ...
}

Why don't use the XPath ? <http://fr.php.net/manual/en/class.domxpath.php>
<http://fr.php.net/manual/en/domxpath.query.php>

This query fetch all a elements with no title attribute or empty title attribute : '//a[not(@title) or @title = ""]' ;


--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--- End Message ---
--- Begin Message ---
Hi. Today, i've got a chicken-and-egg puzzle for your enjoyment :)

In order to properly support google indexing of published content hosted by
my CMS', which scales to browser-size, no matter what it is initially or how
the user resizes it.
Adding meta info for the many pictures hosted via my CMS would greatly
increase natural search results.

In order to get them indexed, i need to provide google with URLs that
contain the complete page's content. Pictures and their descriptions
included.

How many thumbnails get displayed is therefore dependent on (initial)
browser-size.
So I need to know the browser size in the _initial_ php call to my site.

To my knowledge, that's impossible. And besides, google (my target audience
for all of this) doesnt execute JS, so i'll have to choose a browsersize for
the user when he comes in no matter what.

I've come up with this workaround that i'd like your comments and potential
improvements on.

In the html of some page that is crawled, i have a link that's sorta like
this:

http://mediabeez.ws/mediaBeez/
clink.php?cmd=desktop&module=ajax&action=viewCollection&target=misc
This should call up a page with a photo-album.

Currently, to get smoother loading graphic-performance, i split up the
rendering of the desktop that holds the photo-album, and the actual
photo-album content. First the desktop (and worker-JS-libs) would be
properly loaded and displayed, then a loading icon displayed in the photo
album, and then the contents of the photo-album loaded. This mechanism is
currently used on the link above.

The best solution i can come up with till now is to pre-load <IMG>s and
descriptions for a desktop 1024x768 in size, then on running of the
photoalbum js either remove some images or (if i have too few) call my
render_album_contents() again via AJAX with the proper desktop size.

With google analytics i could see what browsersize gets used most, and set
the default to that, to reduce double-calls to the kinda-expensive
render_album_contents() which calls up much meta-info related to the
pictures.

The main problem i see with this approach is for pagination. The initial
link for the 'next page' button should be a static one per "default
browsersize" (for google's indexing) but on running it this should change
back to a JS call that takes that particular users' browser size in account.
I guess that could be achieved with the photo-album js changing the link at
pageLoad(), but it could be tricky.

What i'd like to know from you is if you can see any other way to achieve
google-indexing of all pages of a photo-album that resizes to browser size..

--- End Message ---
--- Begin Message ---
[snip]
Hi. Today, i've got a chicken-and-egg puzzle for your enjoyment :)
[/snip]

This question might be more suitable on Evolt's list (www.evolt.org). I
realize that there is a snippet of PHP in there but the question is less
related to that.

--- End Message ---
--- Begin Message ---
Hi All

I just tested my PHP app on Ubuntu 64bit, and found that all my php scripts would consume about 5x more RAM memory there, compared to how much they use on my macbook pro (which to make things a bit more confusing also runs a 64bit OS). A page that would take up around 2.5 MB on the macbook, takes around 12 MB on the linux server.

Does anyone know what might be causing this?

Thanks
Alec

--- End Message ---
--- Begin Message ---
alexander lind wrote:

> I just tested my PHP app on Ubuntu 64bit, and found that all my php
> scripts would consume about 5x more RAM memory there, compared to how
> much they use on my macbook pro (which to make things a bit more
> confusing also runs a 64bit OS).
> A page that would take up around 2.5 MB on the macbook, takes around
> 12 MB on the linux server.
> 
> Does anyone know what might be causing this?

All pointers are twice the size, same goes for the runtime stack.



/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
But why does that happens?

On Wed, Sep 3, 2008 at 2:42 PM, Per Jessen <[EMAIL PROTECTED]> wrote:

> alexander lind wrote:
>
> > I just tested my PHP app on Ubuntu 64bit, and found that all my php
> > scripts would consume about 5x more RAM memory there, compared to how
> > much they use on my macbook pro (which to make things a bit more
> > confusing also runs a 64bit OS).
> > A page that would take up around 2.5 MB on the macbook, takes around
> > 12 MB on the linux server.
> >
> > Does anyone know what might be causing this?
>
> All pointers are twice the size, same goes for the runtime stack.
>
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Wed, 2008-09-03 at 06:28 -0700, alexander lind wrote:
> Hi All
> 
> I just tested my PHP app on Ubuntu 64bit, and found that all my php  
> scripts would consume about 5x more RAM memory there, compared to how  
> much they use on my macbook pro (which to make things a bit more  
> confusing also runs a 64bit OS).
> A page that would take up around 2.5 MB on the macbook, takes around  
> 12 MB on the linux server.
> 
> Does anyone know what might be causing this?

I have 8 gigs of ram, I can't say I've been counting beans lately :B

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Wed, 2008-09-03 at 15:42 +0200, Per Jessen wrote:
> alexander lind wrote:
> 
> > I just tested my PHP app on Ubuntu 64bit, and found that all my php
> > scripts would consume about 5x more RAM memory there, compared to how
> > much they use on my macbook pro (which to make things a bit more
> > confusing also runs a 64bit OS).
> > A page that would take up around 2.5 MB on the macbook, takes around
> > 12 MB on the linux server.
> > 
> > Does anyone know what might be causing this?
> 
> All pointers are twice the size, same goes for the runtime stack.

But he says it's 5 times the size :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Wed, 2008-09-03 at 14:52 +0100, Hélio Rocha wrote:
> But why does that happens?

64 bit systems use larger intgegers for accessing the stack and memory.
This enables 64 bit systems to access more than the traditional 4.4 gig
memory limit without resorting to tricks.

This is the whole point of getting a 64 bit system. (well that and
performing large number computations more easily)

Cheers,
Rob.



> 
> On Wed, Sep 3, 2008 at 2:42 PM, Per Jessen <[EMAIL PROTECTED]> wrote:
> 
> > alexander lind wrote:
> >
> > > I just tested my PHP app on Ubuntu 64bit, and found that all my php
> > > scripts would consume about 5x more RAM memory there, compared to how
> > > much they use on my macbook pro (which to make things a bit more
> > > confusing also runs a 64bit OS).
> > > A page that would take up around 2.5 MB on the macbook, takes around
> > > 12 MB on the linux server.
> > >
> > > Does anyone know what might be causing this?
> >
> > All pointers are twice the size, same goes for the runtime stack.
> >
> >
> >
> > /Per Jessen, Zürich
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Sep 3, 2008, at 7:13 AM, Robert Cummings wrote:

On Wed, 2008-09-03 at 14:52 +0100, Hélio Rocha wrote:
But why does that happens?

64 bit systems use larger intgegers for accessing the stack and memory. This enables 64 bit systems to access more than the traditional 4.4 gig
memory limit without resorting to tricks.

This is the whole point of getting a 64 bit system. (well that and
performing large number computations more easily)

But I really, really don't see why it would make the php executable consume 500% more memory! I was expecting an increase of maybe 10-20%. Maybe even 50%. But 500% really just seems over the edge.

Alec

--- End Message ---
--- Begin Message ---
On Sep 3, 2008, at 6:42 AM, Per Jessen wrote:

alexander lind wrote:

I just tested my PHP app on Ubuntu 64bit, and found that all my php
scripts would consume about 5x more RAM memory there, compared to how
much they use on my macbook pro (which to make things a bit more
confusing also runs a 64bit OS).
A page that would take up around 2.5 MB on the macbook, takes around
12 MB on the linux server.

Does anyone know what might be causing this?

All pointers are twice the size, same goes for the runtime stack.

Ok, so in the worst case scenario, I would expect it to require maybe twice as much RAM then, but really, not more than maybe 10-20% more since not all code is pointers. But 500% more? That seems a bit steep.

Alec

--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
On Wed, 2008-09-03 at 15:42 +0200, Per Jessen wrote:
alexander lind wrote:

I just tested my PHP app on Ubuntu 64bit, and found that all my php
scripts would consume about 5x more RAM memory there, compared to how
much they use on my macbook pro (which to make things a bit more
confusing also runs a 64bit OS).
A page that would take up around 2.5 MB on the macbook, takes around
12 MB on the linux server.

Does anyone know what might be causing this?
All pointers are twice the size, same goes for the runtime stack.

But he says it's 5 times the size :)

Cheers,
Rob.
I don't get it that people still think 64-bit is twice the 'size' of 32-bit. It's like saying 2 square meters is 2 times a square meter, while actually it is 4 times a square meter.

So, 64-bits don't just take twice the memory, it can take up much more than that. Like somebody else says, the integers take a lot of space, so beware of typecasting properly......
--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other....'/

--- End Message ---
--- Begin Message ---
> ----- Original Message -----
> From: "Dan Joseph" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Secure way to handle pw on session.
> Date: Tue, 2 Sep 2008 15:35:26 -0400
> 
> 
> On Tue, Sep 2, 2008 at 3:27 PM, k bah <[EMAIL PROTECTED]> wrote:
> 
> >
> >  Hi,
> >
> >  I noticed session files are kept on /tmp for a while, and even if they
> > were immediately deleted, well, someone could use one of my php scripts to
> > inject code and read them, since they belong to the httpd user.
> >  What's the best way to receive passwords thru a form and store them in the
> > $_SESSION while I process other information to decide whether or not that
> > user is able to proceed and login (check to see if user is also allowed to
> > use that service, not just validate user/pw)? I use https, always, no plain
> > http is used.
> >
> >  Thanks
> >
> >
> I personally would recommend you never store passwords in $_SESSION.
> 
> I don't know how your auth code works, but the way I've always done it would
> be to process everything when you his submit, with the password being in
> $_POST or $_GET, then after you authenticate the user, drop it and don't
> store it with sessions.  If you find you need it to be stored for other
> things, I'd suggest rethinking the design/checking you're doing.
> 
> --
> -Dan Joseph
> 


 You're right, and thanks to all replies, they were all helpful.
 I rechecked and, really, there's no reason to store password values anywhere, 
the only 2 places in my code where I use passwords I use it "straight out from 
the POST". First I filter the content, only allowing to continue if 
preg_match_all() gives me a "continue" (I compare the return of 
preg_match_all() with strlen(), and if they are not the same, it means that the 
received POST value has at least 1 character that is not allowed), I was 
storing the value on the session, now I simply store it on a script variable 
(it will be unset once the script ends), and after that I pass it to another 
function (present on an included php file which actually communicates with the 
backend where hashed passwords are kept). As you said, after the input cleanup, 
I unset password on $_POST. Now it only stays on the script local variable, and 
the called function which does the real auth, once that function ends and the 
script (a form action url) ends, there's no password. Since I always use https, 
there's no reason to worry with the path between the user browser and the php 
script on the server that receives the POST. If there were no https, I would 
use javascript to not pass the password in plain text to the server.


 thanks again

=


-- 
Powered by Outblaze

--- End Message ---

Reply via email to