php-general Digest 13 Dec 2007 17:02:43 -0000 Issue 5179

Topics (messages 265823 through 265843):

Re: Generating Random Numbers with Normal Distribution
        265823 by: Robert Cummings
        265824 by: Robert Cummings
        265829 by: Jochem Maas
        265835 by: Jay Blanchard

Session call not creating file in session_save_path - perms? (newbie)
        265825 by: Robert Erbaron
        265826 by: Casey
        265827 by: Chris
        265828 by: Robert Erbaron

Re: temp tables mysql OT
        265830 by: Zoltán Németh
        265836 by: tedd
        265837 by: Robert Cummings
        265838 by: Daniel Brown
        265839 by: David Giragosian
        265840 by: Daniel Brown

Session timeout
        265831 by: Dani Castaños
        265832 by: Richard Heyes
        265833 by: Dani Castaños
        265834 by: Richard Heyes
        265842 by: Victor Matherly
        265843 by: Cesar D. Rodas

Re: zlib and fopen and stream_filter_append, prebuffer read errors help
        265841 by: Bob Sabiston

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 Wed, 2007-12-12 at 16:21 -0500, tedd wrote:
> At 3:35 PM -0500 12/12/07, Robert Cummings wrote:
> >On Wed, 2007-12-12 at 13:16 -0500, tedd wrote:
> >>  At 10:17 AM -0500 12/12/07, Robert Cummings wrote:
> >>  >  > In my ancient past I worked with a x-ray detector and we simply
> >>  >>  truncated to the tens digit -- that was pretty random.
> >>  >
> >>  >Random seeming you mean. As mentioned in the original post, just because
> >>  >the timeline and sample space is immense doesn't make it random, it just
> >>  >makes it difficult to guess. In fact, someone already mentioned the case
> >>  >of computers in casinos that can predict the landing spot of a roulette
> >>  >ball.
> >>
> >>  Just because someone said it, doesn't mean it's true.
> >>
> >>  I remember in the old days where they used roulette wheels to
> >>  generate random lists.
> >
> >Seemingly random lists... We haven't proven random yet ;)
> >
> >Cheers,
> >Rob.
> 
> Yeah, but we haven't proven order yet either. :-)

Order exists all around us. I only need to look around me to see the
order that exists. A desk, a table, the structure of crystals, etc, etc.
Random on the other hand is the one to be proven. I look around and I
can also see disorder, but is it random, or is it just messy order. THAT
is the question.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
On Wed, 2007-12-12 at 16:34 -0500, tedd wrote:
> At 3:42 PM -0500 12/12/07, Robert Cummings wrote:
> >  > Yes, but what if my disorder was random?
> >
> >How could you prove it is random? Give me an example of something you
> >can put into disorder that doesn't use the premise of order? For
> >instance throwing a handful of sand into the air is expected to obey the
> >establish laws of physics. These laws of physics suggest order in the
> >universe even when we perceive disorder.
> >
> >Cheers,
> >Rob.
> 
> Yes, but now we're getting back to artificial rules of the mind. We 
> perceive the laws of physics to work a certain way because we have 
> established rules as to how they should work. But, what happens when 
> they don't work? Then we change the rules. We are now at string 
> theory and things still remain disordered. All our efforts to put 
> order to things still fall short.
> 
> Also, when we do change our rules, nature hasn't changed. Nature 
> hasn't suddenly changed to our view, but rather we change our 
> thinking to adapt to observation. And it's in those terms of 
> observation that order and disorder of things comes about and not in 
> nature.

Once again, we're not trying to prove order. Order obviously exists. But
does random? Do the laws of physics randomly change? Just because we're
wrong about something doesn't change the machine. The machine is the
same, our understanding is the only thing that has changed. Even if the
machine changes has it done so randomly? Or according to some rule?

Anyways, this thread could go on forever. Order obviously exists, our
interpretation of what causes that order may be right or wrong, but it
doesn't change the existence of that order. That said we have no obvious
proof that random exists. Looking around I can't say look there, that
certainly is random. All I can say is that it is seemingly random, it
appears very disordered "to me".

I'm going to bail on this thread now... it's gone on too long :) Fun
though. Where's Crayon?

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
> On Wed, 2007-12-12 at 16:21 -0500, tedd wrote:
>> At 3:35 PM -0500 12/12/07, Robert Cummings wrote:
>>> On Wed, 2007-12-12 at 13:16 -0500, tedd wrote:
>>>>  At 10:17 AM -0500 12/12/07, Robert Cummings wrote:
>>>>  >  > In my ancient past I worked with a x-ray detector and we simply
>>>>  >>  truncated to the tens digit -- that was pretty random.
>>>>  >
>>>>  >Random seeming you mean. As mentioned in the original post, just because
>>>>  >the timeline and sample space is immense doesn't make it random, it just
>>>>  >makes it difficult to guess. In fact, someone already mentioned the case
>>>>  >of computers in casinos that can predict the landing spot of a roulette
>>>>  >ball.
>>>>
>>>>  Just because someone said it, doesn't mean it's true.
>>>>
>>>>  I remember in the old days where they used roulette wheels to
>>>>  generate random lists.
>>> Seemingly random lists... We haven't proven random yet ;)
>>>
>>> Cheers,
>>> Rob.
>> Yeah, but we haven't proven order yet either. :-)
> 
> Order exists all around us. I only need to look around me to see the
> order that exists. A desk, a table, the structure of crystals, etc, etc.
> Random on the other hand is the one to be proven. I look around and I
> can also see disorder, but is it random, or is it just messy order. THAT
> is the question.

bla bla bla. neither can ever be proven. proof implies objective truth, given
that everything is subjectively experienced there can be no proof ... one could
wander into the realms of spirituality and presume for one moment there is a
single, indivisible self-realized entity which I would suggest presupposes that
neither order nor randomness nor chaos exists .. in order to have any of those
requires more than one entity to be present.

now the fact that *you* percieve this one indivisible, self-realised entity as
fragmented ... is your problem. :-)

personally I think you should waste less time on such things and take your wife
out for dinner or something ;-)

rgds,
Jochem

PS - Rob, Tedd ... thanks for all the fish!

> 
> Cheers,
> Rob.

--- End Message ---
--- Begin Message ---
[snip]
Where's Crayon?
[/snip]

Steel Cage Death Match with Brad. 

--- End Message ---
--- Begin Message ---
OK, I've read every message on the list for the last year that contains
'sessions'. I've read through (bleary eyed, admittedly)
http://us2.php.net/session. And I swear, honest, that I had this working on
another box (which is no longer available to me.) I've checked phpinfo -
session support is on, session.use_cookie is On. PHP 5.1.6 or thereabouts.

<?php session_start();
session_save_path('/home/rob//Sites/zphpsessions');
echo 'sessionid:'.session_id().':<br>';
echo 'save path:'.session_save_path().':<br>';

$ip = ' '.$_SERVER['REMOTE_ADDR'];
echo '$ip is:'.$ip.':<br>';
$_SESSION['ipx']=$ip;
echo 'ipx (session) is:'.$_SESSION['ipx'].':<br>';
if (!isset($_SESSION['ipx'])) echo 'whoa nelly';
echo 'This is the main page';
?>

Output looks like this:
sessionid:8klvud4o186lme7n6v84lhfjl2:
save path:/home/rob/Sites/zphpsessions:
$ip is: 127.0.0.1:
ipx (session) is: 127.0.0.1:
This is the main page

No data is being dumped into /home/rob/Sites/zphpsessions. The best I can
guess is permissions. If I change save_path to /tmp, no difference - still
nothing being written there. I bet I'm doing something ignorant about apache
users or something, huh?

-- 
RE, Chicago

--- End Message ---
--- Begin Message ---
Read manual please.

http://us.php.net/session_save_path

On Dec 12, 2007 9:27 PM, Robert Erbaron <[EMAIL PROTECTED]> wrote:
> OK, I've read every message on the list for the last year that contains
> 'sessions'. I've read through (bleary eyed, admittedly)
> http://us2.php.net/session. And I swear, honest, that I had this working on
> another box (which is no longer available to me.) I've checked phpinfo -
> session support is on, session.use_cookie is On. PHP 5.1.6 or thereabouts.
>
> <?php session_start();
> session_save_path('/home/rob//Sites/zphpsessions');
> echo 'sessionid:'.session_id().':<br>';
> echo 'save path:'.session_save_path().':<br>';
>
> $ip = ' '.$_SERVER['REMOTE_ADDR'];
> echo '$ip is:'.$ip.':<br>';
> $_SESSION['ipx']=$ip;
> echo 'ipx (session) is:'.$_SESSION['ipx'].':<br>';
> if (!isset($_SESSION['ipx'])) echo 'whoa nelly';
> echo 'This is the main page';
> ?>
>
> Output looks like this:
> sessionid:8klvud4o186lme7n6v84lhfjl2:
> save path:/home/rob/Sites/zphpsessions:
> $ip is: 127.0.0.1:
> ipx (session) is: 127.0.0.1:
> This is the main page
>
> No data is being dumped into /home/rob/Sites/zphpsessions. The best I can
> guess is permissions. If I change save_path to /tmp, no difference - still
> nothing being written there. I bet I'm doing something ignorant about apache
> users or something, huh?
>
> --
> RE, Chicago
>



-- 
-Casey

--- End Message ---
--- Begin Message ---
Robert Erbaron wrote:
OK, I've read every message on the list for the last year that contains
'sessions'. I've read through (bleary eyed, admittedly)
http://us2.php.net/session. And I swear, honest, that I had this working on
another box (which is no longer available to me.) I've checked phpinfo -
session support is on, session.use_cookie is On. PHP 5.1.6 or thereabouts.

<?php session_start();
session_save_path('/home/rob//Sites/zphpsessions');

You need to set the session_save_path before you call session_start.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Aw crap. :)

(session_save_path BEFORE session_start.)

Works fine now... now to clean the egg off face.

Thx,

On Dec 12, 2007 11:31 PM, Casey <[EMAIL PROTECTED]> wrote:

> Read manual please.
>
> http://us.php.net/session_save_path
>
>
-- 
RE, Chicago

--- End Message ---
--- Begin Message ---
2007. 12. 12, szerda keltezéssel 20.13-kor tedd ezt írta:
> Hi gang:
> 
> Another mysql question.
> 
> I would like to create a temporary table to perform searches.
> 
>  From my main table, I need to exclude records that have certain 
> fields that are null or empty; and then sort the final result.

why do you need a temp table for that?
select * from blah where not isnull(checkfield) and checkfield <> ''
order by someotherfield

greets
Zoltán Németh

> 
> I've spent over an hour looking at "How do I set up a temporary table 
> in MySQL?" questions via Google with little help. My eyes and brain 
> are blurry -- giving it up for tonight.
> 
> Anyone have a sample or a clear reference for me to review?
> 
> Thanks in advance guys.
> 
> Cheers,
> 
> tedd
> 
> PS: Watch someone (maybe everyone) jump on "This ain't a MySQL list."
> 
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 

--- End Message ---
--- Begin Message ---
At 12:20 PM +0100 12/13/07, Zoltán Németh wrote:
2007. 12. 12, szerda keltezéssel 20.13-kor tedd ezt írta:
 > I would like to create a temporary table to perform searches.

  From my main table, I need to exclude records that have certain
 fields that are null or empty; and then sort the final result.

why do you need a temp table for that?
select * from blah where not isnull(checkfield) and checkfield <> ''
order by someotherfield

Zoltán:

Ok, here's the problem.

I have a table with over 5000 records.

There is no index (not my dB) and the records are not complete.

There is a numeric product_id field, but in the dB this is not in sequence.

Some records have a product_id, but no product_name.

I need to travel the dB showing each item in order (product _id) and excluding those products that have no product_name.

That sounds simple enough, but currently for each step the entire table gets sorted (unless I'm doing it wrong).

I was thinking that I could:

1. Create a temporary table.
2. Sort the table once.
3. Remove the records that have no product_name
4. And then just travel the temporary table for the duration of the script.
5. Drop the table when done with it.

Now, what's wrong with my thinking?

Cheers,

tedd






--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Thu, 2007-12-13 at 10:14 -0500, tedd wrote:
> At 12:20 PM +0100 12/13/07, Zoltán Németh wrote:
> >2007. 12. 12, szerda keltezéssel 20.13-kor tedd ezt írta:
> >  > I would like to create a temporary table to perform searches.
> >>
> >>   From my main table, I need to exclude records that have certain
> >>  fields that are null or empty; and then sort the final result.
> >
> >why do you need a temp table for that?
> >select * from blah where not isnull(checkfield) and checkfield <> ''
> >order by someotherfield
> 
> Zoltán:
> 
> Ok, here's the problem.
> 
> I have a table with over 5000 records.
> 
> There is no index (not my dB) and the records are not complete.
> 
> There is a numeric product_id field, but in the dB this is not in sequence.
> 
> Some records have a product_id, but no product_name.
> 
> I need to travel the dB showing each item in 
> order (product _id) and excluding those products 
> that have no product_name.
> 
> That sounds simple enough, but currently for each 
> step the entire table gets sorted (unless I'm 
> doing it wrong).
> 
> I was thinking that I could:
> 
> 1. Create a temporary table.
> 2. Sort the table once.
> 3. Remove the records that have no product_name
> 4. And then just travel the temporary table for the duration of the script.
> 5. Drop the table when done with it.
> 
> Now, what's wrong with my thinking?

This is what you reeeeeeally want IMHO:

    ALTER TABLE theTable ADD INDEX( product_id );

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
On Dec 13, 2007 10:14 AM, tedd <[EMAIL PROTECTED]> wrote:
> At 12:20 PM +0100 12/13/07, Zoltán Németh wrote:
> >2007. 12. 12, szerda keltezéssel 20.13-kor tedd ezt írta:
> >  > I would like to create a temporary table to perform searches.
> >>
> >>   From my main table, I need to exclude records that have certain
> >>  fields that are null or empty; and then sort the final result.
> >
> >why do you need a temp table for that?
> >select * from blah where not isnull(checkfield) and checkfield <> ''
> >order by someotherfield
>
> Zoltán:
>
> Ok, here's the problem.
>
> I have a table with over 5000 records.
>
> There is no index (not my dB) and the records are not complete.
>
> There is a numeric product_id field, but in the dB this is not in sequence.
>
> Some records have a product_id, but no product_name.
>
> I need to travel the dB showing each item in
> order (product _id) and excluding those products
> that have no product_name.
>
> That sounds simple enough, but currently for each
> step the entire table gets sorted (unless I'm
> doing it wrong).
>
> I was thinking that I could:
>
> 1. Create a temporary table.
> 2. Sort the table once.
> 3. Remove the records that have no product_name
> 4. And then just travel the temporary table for the duration of the script.
> 5. Drop the table when done with it.
>
> Now, what's wrong with my thinking?
>
> Cheers,
>
> tedd
>
>
>
>
>
>
>
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

<?
// Put DB and config includes here.

$sql = "SELECT * FROM prod_table WHERE product_name != '' ORDER BY product_id";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
    $ssql  = "INSERT INTO tmp_table(product_id,product_name,val,val2) ";
    $ssql .= 
"VALUES('".$row['product_id']."','".$row['product_name']."','$row['val']."','".$row['val2']."')";
    mysql_query($ssql);
}

mysql_query("DROP TABLE prod_table");
mysql_query("RENAME TABLE tmp_table TO prod_table") or die(mysql_error());
?>


-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

--- End Message ---
--- Begin Message ---
On 12/13/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Thu, 2007-12-13 at 10:14 -0500, tedd wrote:
> > At 12:20 PM +0100 12/13/07, Zoltán Németh wrote:
> > >2007. 12. 12, szerda keltezéssel 20.13-kor tedd ezt írta:
> > >  > I would like to create a temporary table to perform searches.
> > >>
> > >>   From my main table, I need to exclude records that have certain
> > >>  fields that are null or empty; and then sort the final result.
> > >
> > >why do you need a temp table for that?
> > >select * from blah where not isnull(checkfield) and checkfield <> ''
> > >order by someotherfield
> >
> > Zoltán:
> >
> > Ok, here's the problem.
> >
> > I have a table with over 5000 records.
> >
> > There is no index (not my dB) and the records are not complete.
> >
> > There is a numeric product_id field, but in the dB this is not in
> sequence.
> >
> > Some records have a product_id, but no product_name.
> >
> > I need to travel the dB showing each item in
> > order (product _id) and excluding those products
> > that have no product_name.
> >
> > That sounds simple enough, but currently for each
> > step the entire table gets sorted (unless I'm
> > doing it wrong).
> >
> > I was thinking that I could:
> >
> > 1. Create a temporary table.
> > 2. Sort the table once.
> > 3. Remove the records that have no product_name
> > 4. And then just travel the temporary table for the duration of the
> script.
> > 5. Drop the table when done with it.
> >
> > Now, what's wrong with my thinking?
>
> This is what you reeeeeeally want IMHO:
>
>    ALTER TABLE theTable ADD INDEX( product_id );
>
> Cheers,
> Rob.
> --
> ...........................................................
> SwarmBuy.com - http://www.swarmbuy.com
>
>    Leveraging the buying power of the masses!
> ...........................................................
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
tedd,

I have multiple tables in a mysql db that have over 1.3 million indexed
records, and selecting the latest 60 records is quick as a bunny, so 5000
records should be a piece of cake.

Also, there is no guarantee of record order in a result set without an order
by clause, which obviously affects sorting.

Rob's suggestion should certainly improve performance.

David

--- End Message ---
--- Begin Message ---
On Dec 13, 2007 10:37 AM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> <?
> // Put DB and config includes here.
>
> $sql = "SELECT * FROM prod_table WHERE product_name != '' ORDER BY 
> product_id";
> $result = mysql_query($sql) or die(mysql_error());
> while($row = mysql_fetch_array($result)) {
>     $ssql  = "INSERT INTO tmp_table(product_id,product_name,val,val2) ";
>     $ssql .= 
> "VALUES('".$row['product_id']."','".$row['product_name']."','$row['val']."','".$row['val2']."')";
>     mysql_query($ssql);
> }
>
> mysql_query("DROP TABLE prod_table");
> mysql_query("RENAME TABLE tmp_table TO prod_table") or die(mysql_error());
> ?>

    There are much prettier, cleaner, more efficient ways of doing it,
I'm sure, but if you're banging your head off the wall just vying for
a simple solution, MySQL can handle the ~5,001 queries without issue.
;-)

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

--- End Message ---
--- Begin Message ---
Hi all!

I've read a bit about PHP session timeout. Is it configurable?? I mean, If i want user logged out after 10 minutes of innactivity... where i can to set it up?? Is it possible to expire session configuring php.ini.
I know i will have to write code to do whatever when the session expires...

Thank you in advance

--- End Message ---
--- Begin Message ---
I've read a bit about PHP session timeout. Is it configurable?? I mean, If i want user logged out after 10 minutes of innactivity... where i can to set it up?? Is it possible to expire session configuring php.ini.
I know i will have to write code to do whatever when the session expires...

There are various configuration options for this (which you change in the php.ini or by using the ini_set() function):

session.gc_maxlifetime
session.cookie_lifetime

Read all about sessions here:

http://uk.php.net/manual/en/ref.session.php

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

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

There are various configuration options for this (which you change in the php.ini or by using the ini_set() function):

session.gc_maxlifetime
session.cookie_lifetime


Before sending my first mail, i've changed those parameters... and nothing seems to change. I set up also session.cache_expire... but... nothing happens... session does not expire
--- End Message ---
--- Begin Message ---
There are various configuration options for this (which you change in the php.ini or by using the ini_set() function):

session.gc_maxlifetime
session.cookie_lifetime


Before sending my first mail, i've changed those parameters... and nothing seems to change. I set up also session.cache_expire... but... nothing happens... session does not expire

If you change them in your php.ini don't forget you'll need to restart your web server.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

--- End Message ---
--- Begin Message ---
You could always just set you own cookie that expires after 10 min. Have your 
script  redirect to a login page if the cookie has expired or reset the cookie 
if its still valid. 



----- Original Message -----
From: "Dani Castaños" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Thursday, December 13, 2007 7:36:06 AM (GMT-0500) America/New_York
Subject: [PHP] Session timeout

Hi all!

I've read a bit about PHP session timeout. Is it configurable?? I mean, 
If i want user logged out after 10 minutes of innactivity... where i can 
to set it up?? Is it possible to expire session configuring php.ini.
I know i will have to write code to do whatever when the session expires...

Thank you in advance

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
Victor J. Matherly
Technical Services
Wave Communications, Inc
http://www.wave-communications.com

--- End Message ---
--- Begin Message ---
You can simulate that, because not always you'll be able to do "init_set"

You can save in a session var the TTL (time to live)
$_SESSION['TTL'] = time() + TIMEOUT;

Then before do anything you see if the session is still valid
if ( $_SESSION['TTL'] <  time() )  close_session();


I hope this be helpful for you!

On 13/12/2007, Richard Heyes <[EMAIL PROTECTED]> wrote:
>
> > I've read a bit about PHP session timeout. Is it configurable?? I mean,
> > If i want user logged out after 10 minutes of innactivity... where i can
> > to set it up?? Is it possible to expire session configuring php.ini.
> > I know i will have to write code to do whatever when the session
> expires...
>
> There are various configuration options for this (which you change in
> the php.ini or by using the ini_set() function):
>
> session.gc_maxlifetime
> session.cookie_lifetime
>
> Read all about sessions here:
>
> http://uk.php.net/manual/en/ref.session.php
>
> --
> Richard Heyes
> http://www.websupportsolutions.co.uk
>
> Knowledge Base and HelpDesk software
> that can cut the cost of online support
>
> ** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Best Regards

Cesar D. Rodas
http://www.cesarodas.com
http://www.thyphp.com
http://www.phpajax.org
Phone: +595-961-974165

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

On Dec 12, 2007, at 7:20 PM, Casey wrote:

Try gzuncompress();

Correct me if I'm wrong, but isn't gzuncompress used for 'gzip' files? Although they both use the same compression, gzip is specific to files and has header information not present in straight zlib data. And as I've mentioned, this is a normal file, not compressed -- I'm just trying to read and decompress pieces of data within the file, which according to the documentation is something zlib does.

I assume that most people use these functions for entire files, but surely someone has used it the other way as well?

Thanks for any info.
Bob





On Dec 12, 2007, at 1:03 PM, Bob Sabiston <[EMAIL PROTECTED]> wrote:


On Dec 12, 2007, at 2:31 PM, Richard Lynch wrote:

On Wed, December 12, 2007 11:28 am, Bob Sabiston wrote:
I'm trying to read some zlib-compressed data from a regular binary
file. When I try to attach the zlib compression filter, I am getting an error: something about how the prebuffered data didn't work with
the filter and so the filter wasn't added to the filter chain.


I looked and found a way to turn off buffering for stream *writes*,
but not for stream reads.  Can anyone help with ideas for why this
isn't working?  I posted questions to comp.lang.php and received no
response.

If all else fails, you could just not use the fancy-pants new stream
and filter functions, and just use http://php.net/zlib directly on the
file.
Sorry Richard for the double mail, I didn't have the list cc'd before...

How could I do that? I thought the only way to use zlib in PHP was through the stream functions.



It's also possible your zlib file is just plain corrupt, and neither
will work...

But I am getting the error before I start to read -- it is not a zlib 'file', it is a stretch of data within
an ordinary file that has been compressed with zlib.

Thanks
Bob

--- End Message ---

Reply via email to