php-general Digest 7 Nov 2007 08:02:07 -0000 Issue 5114

Topics (messages 264146 through 264167):

Re: Can I make a process run in background?
        264146 by: Robert Cummings
        264162 by: Per Jessen

Re: PHP Won't Access Files Outside Web Root (Leopard/MacOS X 10.5) *SOLVED*
        264147 by: Daniel Brown
        264149 by: Rahul S. Johari

Re: More info on timeout problem, with code
        264148 by: Daniel Brown
        264154 by: Chris
        264160 by: Jon Westcot

Re: Can not run PHP pages in Apache
        264150 by: SFWahoo
        264151 by: Daniel Brown

Re: Regular Expressions
        264152 by: Jim Lucas
        264155 by: Martin Alterisio
        264157 by: Robert Cummings
        264159 by: Jim Lucas
        264164 by: Robert Cummings

Sessionvariable
        264153 by: Ronald Wiplinger

php.ini include_path and symlinks
        264156 by: Ravi Menon
        264158 by: Robert Cummings

Re: gzuncompress() Not Working.
        264161 by: heavyccasey.gmail.com
        264163 by: Per Jessen
        264165 by: heavyccasey.gmail.com

Tables, flash and text
        264166 by: Brad

back-up mysql database using PHP
        264167 by: Vanessa Vega

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, 2007-11-06 at 20:23 +0100, Luca Paolella wrote:
> > This can be done quite easily using shared memory and/or a database to
> > share data between the scripts.
> Really? could you give me a little briefing about this method?

I'll give an example using the DB as the sharing mechanism. So you have
master script:

    MASTER (waves hello)

The MASTER can spawn off any number of child background scripts. These
can be CHILD1, CHILD2, CHILD3, ..., CHILDX. When spawning a child script
you can pass it command line parameters. One such parameter I suggest
would be a UID for the CHILD process assigned by the MASTER. Another
such parameter you should probably pass is a UID for the master process.
How you generate UIDs is up to you. You could use PIDs but if your
script runs for a long time then you may re-encounter a PID down the
line. So now themaster knows his childen via the CHILD's UID (CHUID) and
the children know the master via the MASTER's UID (MUID). Now all you
need is a database table that stores messages (a message can be
anything, serialize()'d data comes to mind as a good example). You could
have a table as follows:

    CREATE TABLE messages
    (
        id           bigint    not null   auto_increment,
        scriptUid    bigint    not null,
        message      BLOB,

        PRIMARY KEY ( id ),
        INDEX ( scriptUid )
    );

Now your master can insert messages to it's children by inserting a row
into the table with scriptUid set to the appropriate CHUID. Similarly,
children can send messages back to the master by setting scriptUid to
the MUID that spawned them. One such message might be...

    $message = array
    (
        'type' => 'childList',
        'value => array( 10001, 10002, 10003 ),
    );

    $message = serialize( $message );

This would provide the child with a list of CHUIDs for all the other
children.

This is the basics. A very simplistic example. When a child retrieves a
message it should delete all messages for it's UID less than or equal to
the highest ID it received. This way the next retrieval doesn't return
previously received messages.

Anyways, this is just one way. More complex techniques can be done by
having the master listen on a socket and having the children connect to
the socket when loaded. Then messages can be passed around via sockets.
This is probably preferable since the DB solution requires polling the
database for new messages, whereas I believe PHP sockets support wakeup
on socket data with wakeup as is standard in C sockets.

The shared memory method might be the best solution but I'm not familiar
enough with it to say for sure.

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

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

--- End Message ---
--- Begin Message ---
Robert Cummings wrote:

> On Tue, 2007-11-06 at 19:33 +0100, Per Jessen wrote:
>> Jason Pruim wrote:
>> 
>> > Actually, what you are looking for is an eggdrop bot which is
>> > written in TCL. PHP in my humble opinion was not designed to handle
>> > something like that as it requires realtime processing. Someone
>> > correct me if I'm wrong but that isn't what PHP was designed to do
>> > was it?
>> 
>> I would tend to agree with you, but PHP has been made to do a lot of
>> things it was never really designed for.
> 
> So many more things. It's my first choice for shell scripting
> especially as ties into web projects since all the code can be shared.

Same here - it simplifies things tremendously when you have just one
scripting/programming language to deal with.  


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
On 11/6/07, Rahul S. Johari <[EMAIL PROTECTED]> wrote:
> I guess I can officially consider this case closed with all problems solved!
>
> Thanks All!

    We are the geniuses that are the core PHP community.  Hear us roar!


-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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 11/6/07 4:07 PM, "Daniel Brown" <[EMAIL PROTECTED]> wrote:

>     We are the geniuses that are the core PHP community.  Hear us roar!

:D

You know the funniest thing? As my discussion progressed, and the
contributions back & forth, the problem became evidently little to do with
PHP and a whole lot to do with Mac OS X! And yet, on a PHP mailing list - we
Solved it!

Diversity in Unity!

Of course, I've heard longer, endless, pointless rants in this same very
mailing list over the course of last 6 years or so that I've been here.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: [EMAIL PROTECTED]
 

--- End Message ---
--- Begin Message ---
    Jon,

    I can provide you with access to a Linux web box to test your code
and database stuff if you'd like.  No charge or anything, it's just
that I strongly believe the problems are caused by the limits you face
with your current web host.  If you want to give it a shot, let me
know and I'll set it up for you.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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 ---
Jon Westcot wrote:
Hi David, et al.:

    Thanks for the comment.  I removed the trailing semi-colon in the two
areas where it was being sent to mysql_query() and tried the code again.
I'm still getting the same basic problem -- it silently aborts somewhere
around 22,000 to 26,000 records being processed out of just under 30,000.
When I don't build the $insert_query string, I am able to read through the
CSV file completely.

What indexes are on this table?

When you do an insert, each one has to update the index as well as the data, so maybe that's where all the time is being spent in the database (doubt it's the problem but try dropping all of the indexes on the table).

Are you commenting out this whole section?

            $insert_query = "INSERT INTO evall VALUES(";
            for ($c=0; $c < $num; $c++) {
                if($c > 0) {
                    $insert_query .= ",";
                }
                $insert_query .= '"' . $data[$c] . '"';
            }
            $insert_query .= ");";

Try

$insert_query = "INSERT INTO evall values ('" . implode('\'', $data) . "')";

so you're not doing a for loop when you don't need to.


Also as someone else suggested if this is a csv file you can use LOAD DATA INFILE to directly import it instead of having to create a bunch of insert queries.

See http://dev.mysql.com/doc/refman/5.1/en/load-data.html

Only do this if you are 100% sure of the data (ie it it sanitized in some other step).

    As odd as this sounds, should I put in some type of delay?  Could the
system be thinking it's getting flooded by all of the inserts?

Doubt it.

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

--- End Message ---
--- Begin Message ---
Hi Chris:

> What indexes are on this table?

    On the import table, there is only one index.  And I probably don't even
need an index on it since it will be processed sequentially into other
tables after it's been imported.

> When you do an insert, each one has to update the index
> as well as the data, so maybe that's where all the time is
> being spent in the database (doubt it's the problem but
> try dropping all of the indexes on the table).

    I will try this.

> Are you commenting out this whole section?
>
>              $insert_query = "INSERT INTO evall VALUES(";
>              for ($c=0; $c < $num; $c++) {
>                  if($c > 0) {
>                      $insert_query .= ",";
>                  }
>                  $insert_query .= '"' . $data[$c] . '"';
>              }
>              $insert_query .= ");";

    Only for the point of testing; normally, that code would need to be
included to generate the INSERT query.

> Try
>
> $insert_query = "INSERT INTO evall values ('" . implode('\'', $data) .
"')";
>
> so you're not doing a for loop when you don't need to.

    Thanks for the suggestion.  But, won't the "glue" part actually need to
be something like:

        '\',\''

    That is, I need to close the single quote, place a comma after the
field, and then add in another opening quote.  One other thing: I suspect I
need to use addslashes() to the elements in $data -- is there a way to do
this with one statement as you've done above?

> Also as someone else suggested if this is a csv file you
> can use LOAD DATA INFILE to directly import it instead
> of having to create a bunch of insert queries.
>
> See http://dev.mysql.com/doc/refman/5.1/en/load-data.html
>
> Only do this if you are 100% sure of the data (ie it it sanitized in
> some other step).

    Trying to use LOAD DATA INFILE was my initial plan, but that simply
didn't work.  Turns out that it's because of being on a shared server.  I've
talked with The Powers That Be about this and they're going to move to a
dedicated virtual server; that should give me much more flexibility and
control over what I need to update in the various settings and files and
things to get past all of the heartburn I've had over the last weeks.

> >     As odd as this sounds, should I put in some type of
> > delay?  Could the system be thinking it's getting flooded
> > by all of the inserts?
>
> Doubt it.

    Surprisingly enough, when I've used something like usleep(15000), I seem
to be able to process more records than when I don't have it at all.
::shrug::  Just clutching at straws.

    Thanks again for your comments.  I appreciate them all!

    Jon

--- End Message ---
--- Begin Message ---
Thanks.  And this did work.  Or at least I am able to access php pages. 
Given your comment about 1.3 vs. 2.2, I upgraded to 2.2.  And I now have a
different issue.  When accessing a PHP page the Apache HTTP Server process
crashes or I get a memory error.  Any ideas?


Daniel Brown-5 wrote:
> 
> On 11/6/07, SFWahoo <[EMAIL PROTECTED]> wrote:
>> I have installed Apache 1.3 and PHP 5.2.4.  I am now trying to install
>> Zen
>> Cart.  When accessing the Zen Cart setup, the PHP files are not read. I
>> simply get a directory listing of files instead of execution of the
>> index.php.  Seems I have missed something in the config files. When I run
>> php -v, everything seems to be fine with PHP, I just do not run PHP
>> files.
> 
>     That sounds like your DirectoryIndex directive needs to be
> updated.  Check your httpd.conf file and make sure it looks
> [something] like this:
> 
> <IfModule mod_dir.c>
>     DirectoryIndex index.html index.wml index.cgi index.shtml
> index.jsp index.js index.jp index.php4 index.php3 index.php
> index.phtml index.htm default.htm default.html home.htm
> </IfModule>
> 
>     Also be sure to check that you have these lines:
> AddHandler application/x-httpd-php .php .php4 .php3 .phtml
> AddHandler application/x-httpd-php-source .phps
> AddType application/x-httpd-php .php .php4 .php3 .phtml
> AddType application/x-httpd-php-source .phps
> 
>     Once you've added those lines, just restart Apache.
> 
>     Keep in mind (you, too, archive readers!) that this is httpd
> 1.3.x-specific, and the syntax won't work on 2.x.
> 
> -- 
> Daniel P. Brown
> [office] (570-) 587-7080 Ext. 272
> [mobile] (570-) 766-8107
> 
> 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.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can-not-run-PHP-pages-in-Apache-tf4759553.html#a13616858
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
On 11/6/07, SFWahoo <[EMAIL PROTECTED]> wrote:
>
> Thanks.  And this did work.  Or at least I am able to access php pages.
> Given your comment about 1.3 vs. 2.2, I upgraded to 2.2.  And I now have a
> different issue.  When accessing a PHP page the Apache HTTP Server process
> crashes or I get a memory error.  Any ideas?
>
>
> Daniel Brown-5 wrote:
> >
> > On 11/6/07, SFWahoo <[EMAIL PROTECTED]> wrote:
> >> I have installed Apache 1.3 and PHP 5.2.4.  I am now trying to install
> >> Zen
> >> Cart.  When accessing the Zen Cart setup, the PHP files are not read. I
> >> simply get a directory listing of files instead of execution of the
> >> index.php.  Seems I have missed something in the config files. When I run
> >> php -v, everything seems to be fine with PHP, I just do not run PHP
> >> files.
> >
> >     That sounds like your DirectoryIndex directive needs to be
> > updated.  Check your httpd.conf file and make sure it looks
> > [something] like this:
> >
> > <IfModule mod_dir.c>
> >     DirectoryIndex index.html index.wml index.cgi index.shtml
> > index.jsp index.js index.jp index.php4 index.php3 index.php
> > index.phtml index.htm default.htm default.html home.htm
> > </IfModule>
> >
> >     Also be sure to check that you have these lines:
> > AddHandler application/x-httpd-php .php .php4 .php3 .phtml
> > AddHandler application/x-httpd-php-source .phps
> > AddType application/x-httpd-php .php .php4 .php3 .phtml
> > AddType application/x-httpd-php-source .phps
> >
> >     Once you've added those lines, just restart Apache.
> >
> >     Keep in mind (you, too, archive readers!) that this is httpd
> > 1.3.x-specific, and the syntax won't work on 2.x.
> >
> > --
> > Daniel P. Brown
> > [office] (570-) 587-7080 Ext. 272
> > [mobile] (570-) 766-8107
> >
> > 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.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Can-not-run-PHP-pages-in-Apache-tf4759553.html#a13616858
> Sent from the PHP - General mailing list archive at Nabble.com.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    Did you recompile the module for Apache 2 and the apxs2 module?

    In general, on a *nix-like system (i.e. - "non-Windows"), you
can't swap a module like PHP from one major version of Apache to
another.  While a lot will work, most won't, and there can be some
serious repercussions, least of all being a segfault.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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 ---
Alberto García Gómez wrote:
I'm a mess in regular expressions and I make this code:

$link = ereg_replace('&ntilde;','n',$link); $link = ereg_replace('&aacute;','a',$link); $link = ereg_replace('&eacute;','e',$link); $link = ereg_replace('&iacute;','i',$link); $link = ereg_replace('&oacute;','o',$link); $link = ereg_replace('&uacute;','u',$link);
I ask if is a way to make those lines into a single one but working as well as 
this piece. I'm thinking in increase those lines so will be wonderful if I can 
optimize the code.



Este correo ha sido enviado desde el Politécnico de Informática "Carlos Marx" 
de Matanzas.
"La gran batalla se librará en el campo de las ideas"


<?php

$replacements = array(
        '&ntilde;' => 'n',
        '&aacute;' => 'a',
        '&eacute;' => 'e',
        '&iacute;' => 'i',
        '&oacute;' => 'o',
        '&uacute;' => 'u',
        );

$out = str_replace(array_keys($replacements), array_values($replacements), $in);





--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
2007/11/6, Alberto García Gómez <[EMAIL PROTECTED]>:
>
> I'm a mess in regular expressions and I make this code:
>
> $link = ereg_replace('&ntilde;','n',$link);
> $link = ereg_replace('&aacute;','a',$link);
> $link = ereg_replace('&eacute;','e',$link);
> $link = ereg_replace('&iacute;','i',$link);
> $link = ereg_replace('&oacute;','o',$link);
> $link = ereg_replace('&uacute;','u',$link);
>
> I ask if is a way to make those lines into a single one but working as
> well as this piece. I'm thinking in increase those lines so will be
> wonderful if I can optimize the code.
>
>
>
> Este correo ha sido enviado desde el Politécnico de Informática "Carlos
> Marx" de Matanzas.
> "La gran batalla se librará en el campo de las ideas"
>

Use str_replace instead of ereg_replace. You don't need regular expressions
there.
Your code is good as it is, one line per string replacemente. Don't mess up
code readability just for the sake of some lousy optimization, it's not
worthy.

----

(in spanish)

Usa str_replace en lugar de ereg_replace. No necesitas expresiones regulares
en este caso.
Tu código está bien así, una línea por reemplazo. No arruines la legibilidad
del código solo por una optimización inútil, no vale la pena.

--- End Message ---
--- Begin Message ---
On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote:
> 2007/11/6, Alberto García Gómez <[EMAIL PROTECTED]>:
> >
> > I'm a mess in regular expressions and I make this code:
> >
> > $link = ereg_replace('&ntilde;','n',$link);
> > $link = ereg_replace('&aacute;','a',$link);
> > $link = ereg_replace('&eacute;','e',$link);
> > $link = ereg_replace('&iacute;','i',$link);
> > $link = ereg_replace('&oacute;','o',$link);
> > $link = ereg_replace('&uacute;','u',$link);
> >
> > I ask if is a way to make those lines into a single one but working as
> > well as this piece. I'm thinking in increase those lines so will be
> > wonderful if I can optimize the code.

<?php

    $map = array
    (
        '&ntilde;', 'n',
        '&aacute;', 'a',
        '&eacute;', 'e',
        '&iacute;', 'i',
        '&oacute;', 'o',
        '&uacute;', 'u',
    );

    $link =
        str_replace(
            array_keys( $map ), array_values( $map ), $link );

?>

The only way to make it faster is to build the key array and value array
separately, but then the association is not so clear.

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

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

--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote:
2007/11/6, Alberto García Gómez <[EMAIL PROTECTED]>:
I'm a mess in regular expressions and I make this code:

$link = ereg_replace('&ntilde;','n',$link);
$link = ereg_replace('&aacute;','a',$link);
$link = ereg_replace('&eacute;','e',$link);
$link = ereg_replace('&iacute;','i',$link);
$link = ereg_replace('&oacute;','o',$link);
$link = ereg_replace('&uacute;','u',$link);

I ask if is a way to make those lines into a single one but working as
well as this piece. I'm thinking in increase those lines so will be
wonderful if I can optimize the code.

<?php

    $map = array
    (
        '&ntilde;', 'n',
        '&aacute;', 'a',
        '&eacute;', 'e',
        '&iacute;', 'i',
        '&oacute;', 'o',
        '&uacute;', 'u',

one mistake, your commas above, between the index and value,
should be a "=>" instead

    );

    $link =
        str_replace(
            array_keys( $map ), array_values( $map ), $link );

?>

The only way to make it faster is to build the key array and value array
separately, but then the association is not so clear.

Cheers,
Rob.


--
Jim Lucas


    "Perseverance is not a long race;
        it is many short races one after the other"

Walter Elliot



    "Some men are born to greatness, some achieve greatness,
        and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--- End Message ---
--- Begin Message ---
On Tue, 2007-11-06 at 20:15 -0800, Jim Lucas wrote:
> Robert Cummings wrote:
> > On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote:
> >> 2007/11/6, Alberto García Gómez <[EMAIL PROTECTED]>:
> >>> I'm a mess in regular expressions and I make this code:
> >>>
> >>> $link = ereg_replace('&ntilde;','n',$link);
> >>> $link = ereg_replace('&aacute;','a',$link);
> >>> $link = ereg_replace('&eacute;','e',$link);
> >>> $link = ereg_replace('&iacute;','i',$link);
> >>> $link = ereg_replace('&oacute;','o',$link);
> >>> $link = ereg_replace('&uacute;','u',$link);
> >>>
> >>> I ask if is a way to make those lines into a single one but working as
> >>> well as this piece. I'm thinking in increase those lines so will be
> >>> wonderful if I can optimize the code.
> > 
> > <?php
> > 
> >     $map = array
> >     (
> >         '&ntilde;', 'n',
> >         '&aacute;', 'a',
> >         '&eacute;', 'e',
> >         '&iacute;', 'i',
> >         '&oacute;', 'o',
> >         '&uacute;', 'u',
> 
> one mistake, your commas above, between the index and value,
> should be a "=>" instead

Yeah, I didn't actually test after cutting/pasting and reformatting...
was feeling lazy... that'll learn me :)

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

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

--- End Message ---
--- Begin Message ---
I use at the first page a session variable to set a flag.

After a few pages, or if somebody wait too long, the pages have another
flag.

I noticed that there are often more than one session file exist.

How can I avoid that?
How can I make sure that for one user is only one session file?

bye

Ronald

--- End Message ---
--- Begin Message ---
Hi,

We run php 5.2.0 + apache 2.2. with apc turned on ( apc.stat also on
). Earlier we did not use the php.ini include_path setting. We relied
on some symlinks for our common code
so that require_once works correctly.

This worked fine and during code releases we flipped the main
'release' symlink atomically, without restarting apache.

Later we decided to use php.ini include path to refactor common code
more cleanly and it looks like:

include_path=.:/some/dir/current:......

Now 'current' above is a symlink.

When we push out a new release the current is updated atomically and
apache is not restarted.

This seems to pick the new changes and I ran some manual tests to
confirm. However occasionally I see weird
errors where it seems php could be resolving the symlink to the actual
dir. at apache startup, and it assumes
that old dir. When a new release goes out, we see 'fatal redeclare errors' etc..

Restarting apache (TERM and not USR1) seems to fix it.

We could update our install scripts to restart apache, but I am just
curious, is this really necessary?

Is there anyway to prevent php from not resolving symlinks but use
them as it is in the include_path?

Thanks,
Ravi

--- End Message ---
--- Begin Message ---
On Tue, 2007-11-06 at 18:35 -0800, Ravi Menon wrote:
> Hi,
> 
> We run php 5.2.0 + apache 2.2. with apc turned on ( apc.stat also on
> ). Earlier we did not use the php.ini include_path setting. We relied
> on some symlinks for our common code
> so that require_once works correctly.
> 
> This worked fine and during code releases we flipped the main
> 'release' symlink atomically, without restarting apache.
> 
> Later we decided to use php.ini include path to refactor common code
> more cleanly and it looks like:
> 
> include_path=.:/some/dir/current:......
> 
> Now 'current' above is a symlink.
> 
> When we push out a new release the current is updated atomically and
> apache is not restarted.
> 
> This seems to pick the new changes and I ran some manual tests to
> confirm. However occasionally I see weird
> errors where it seems php could be resolving the symlink to the actual
> dir. at apache startup, and it assumes
> that old dir. When a new release goes out, we see 'fatal redeclare errors' 
> etc..
> 
> Restarting apache (TERM and not USR1) seems to fix it.
> 
> We could update our install scripts to restart apache, but I am just
> curious, is this really necessary?
> 
> Is there anyway to prevent php from not resolving symlinks but use
> them as it is in the include_path?

Are you using a compile cache like eaccelerator or APC etc? Sometimes
it's the cache that doesn't realize things have changed. I use a symlink
switcher for version releases also and I always flush the eaccelerator
directory when I do that.

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

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

--- End Message ---
--- Begin Message ---
Alright, I think I know the problem.

PHP's gzuncompress uses the Adler-32 checksum at the end of the zlib,
while Python uses CRC32.

Why must you follow the standards, PHP!?

Does anyone know of any workaround?

On Nov 6, 2007 7:03 AM,  <[EMAIL PROTECTED]> wrote:
> I left that empty. The decompressed string is about 224 KB, so it
> shouldn't throw an error. Thanks for the reply!
>
>
>
>
> On Nov 6, 2007 12:25 AM, Per Jessen <[EMAIL PROTECTED]> wrote:
> > Casey wrote:
> >
> > > When I try gzuncompress() on the same data (I checked), it returns a
> > > "Data error". I also tried gzinflate() and many user-created gzdecode
> > > () functions, with no luck.
> >
> > Did you specify a correct length for gzuncompress() ?
> >
> > >From the manpage:
> >
> > The function will return an error if the uncompressed data is more than
> > the optional parameter length.
> >
> >
> > /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 ---
[EMAIL PROTECTED] wrote:

> Alright, I think I know the problem.
> 
> PHP's gzuncompress uses the Adler-32 checksum at the end of the zlib,
> while Python uses CRC32.
> 
> Why must you follow the standards, PHP!?
> 
> Does anyone know of any workaround?

Are you saying that you've got compressed data in one format by Python
that cannot be uncompressed by PHP because it expects another format?   


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
The documentation for zlib says that it expects an Adler-32 checksum
at the end of the file.

PHP follows this [largely outdated] standard.

Python, on the other hand, doesn't, and uses a different checksum, CRC-32.

That's why it won't decompress. But I've written my own function and
it's working now. :)
        function fixAdler32($data) {
                $tempnam = tempnam('/tmp', 'gzfix');
                $fh = fopen($tempnam, 'wb');
                
                fwrite($fh, "\x1f\x8b\x08\x00\x00\x00\x00\x00" . $data);
                fclose($fh);
                
                $dat = '';
                $gz = gzopen($tempnam, 'rb');
                if ($gz == false) die('Error opening temporary GZ file.');
        
                do {
                        $dat .= gzread($gz, 100000);
                } while (!feof($gz));
                gzclose($gz);
                unlink($tempnam);
                return $dat;
        }


On Nov 6, 2007 11:07 PM, Per Jessen <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
>
> > Alright, I think I know the problem.
> >
> > PHP's gzuncompress uses the Adler-32 checksum at the end of the zlib,
> > while Python uses CRC32.
> >
> > Why must you follow the standards, PHP!?
> >
> > Does anyone know of any workaround?
>
> Are you saying that you've got compressed data in one format by Python
> that cannot be uncompressed by PHP because it expects another format?
>
>
>
> /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 ---
I just picked up an account to fix a website and the code is making no
sense.

The site is HYPERLINK
"http://www.gaymillionaire.net/"http://www.gaymillionaire.net

I am trying to get the text below the flash video next to the video instead
below it.

 

I widened the table and still nothing.

This website is one of those modular pre-purchased sites so I am not sure
how deep I made need to go inside of the code.

 

Fortunately it is mainly written in php.

 

Maybe some kind person can point me to some good reading material to
understand what is goin on.

 

Here is the relevant code!

 

Thank you kindly for any assistance

 

<div class="padded">

 

<div class="columnWide">

<?php $this->loadTemplate("boxes/simple.tpl", false, array('secheader' =>
$this->language['welcome'], 'class' => 'brown'), true); ?>


 

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=7,0,19,0" 

declare="declare" name="gay personals, lesbian dating" 

width="325" height="310" title="flash">

                                <param name="movie" 

value="slideshow_as1.swf" />

                                <param name="quality" value="high" />

                                <embed src="gfx/slideshow_as1.swf" 

quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"; 

type="application/x-shockwave-flash" width="325" height="310"></embed>

                              </object>

<br>

Not a member yet? Please <a href="index.php?page=join">click here</a> to
join 

for FREE or push the button "Join now" below to apply and start networking
with more then

35,000 members of GayMillionaire.net!<br>

<br>

100% FREE

<br>

1000's of attractive distinguished & successful gay millionaires

<br>

Comprehensive & tasteful photos / profiles

<br>

Quality Gay Members of all ages

<br>

Date like minded people that want more from life

<br>

International gay audience

<br>

Prestige executive & affluent gay members

<br>

Aquire the lifestyle you want & deserve

<br>

No outragious service fees

<br>

<td>

<div style="text-align:center;padding:10px;"><input class="button"
type="button" value="<?php echo $this->language['join']; ?>"
onClick="window.location='index.php?page=join'"></div>

 

Gay & lesbian Millionaire dating in the United States

 

The acceptance of Gay and Lesbian is brighter and more global then it ever
has been.  There are certain 

areas where it just blossoms. Gay dating and lesbian dating is at its all
time high.

 

Here at gaymillionaire.net we help the community with the largest
collectionof lesbian and gay personals on 

the net. 

 

</td>

<?php $this->loadTemplate("boxes/simple_close.tpl", false, array(), true);
?>

 

<?php $this->loadTemplate("divider.tpl", false, array('type' => 'h'), true);
?>

 

<?php $this->loadTemplate("boxes/simple.tpl", false, array('secheader' =>
$this->language['recent_members'], 'class' => 'blue'), true); ?>

<?php $this->loadTemplate("lists/simple.tpl", false, array('wrap' => 1,
'from' => $this->recent_members, 'box' => "boxes/member.tpl"), true); ?>

<?php $this->loadTemplate("boxes/simple_close.tpl", false, array(), true);
?>

 

<?php $this->loadTemplate("divider.tpl", false, array('type' => 'h'), true);
?>

 

<?php $this->loadTemplate("boxes/simple.tpl", false, array('secheader' =>
$this->language['recent_blogs'], 'class' => 'blue'), true); ?>

<?php $this->loadTemplate("lists/list_enhanced.tpl", false, array('from' =>
$this->recent_blogs, 'columns' =>
($this->language['title_and_description'])."|".($this->language['posts'])."|
".($this->language['photo'])."|".($this->language['action']), 'widths' =>
"|40|70|100", 'indexes' => "title|posts|photo|action", 'class' => 'blue'),
true); ?>

<?php $this->loadTemplate("boxes/simple_close.tpl", false, array(), true);
?>

 

<?php $this->loadTemplate("divider.tpl", false, array('type' => 'h'), true);
?>

 

<?php $this->loadTemplate("boxes/simple.tpl", false, array('secheader' =>
$this->language['recent_classifieds'], 'class' => 'blue'), true); ?>

<?php $this->loadTemplate("lists/list_enhanced.tpl", false, array('from' =>
$this->recent_classifieds, 'columns' =>
($this->language['title_and_description'])."|".($this->language['photo'])."|
".($this->language['action']), 'widths' => "|70|100", 'indexes' =>
"title|photo|action", 'class' => 'blue'), true); ?>

<?php $this->loadTemplate("boxes/simple_close.tpl", false, array(), true);
?>

 

<?php $this->loadTemplate("divider.tpl", false, array('type' => 'h'), true);
?>

 

<?php $this->loadTemplate("boxes/simple.tpl", false, array('secheader' =>
$this->language['recent_events'], 'class' => 'blue'), true); ?>

<?php $this->loadTemplate("lists/list_enhanced.tpl", false, array('from' =>
$this->recent_events, 'columns' =>
($this->language['title_and_description'])."|".($this->language['date_time']
)."|".($this->language['photo'])."|".($this->language['action']), 'widths'
=> "|100|70|100", 'indexes' => "title|date|photo|action", 'class' =>
'blue'), true); ?>

<?php $this->loadTemplate("boxes/simple_close.tpl", false, array(), true);
?>

 

<?php $this->loadTemplate("divider.tpl", false, array('type' => 'h'), true);
?>

 

<?php $this->loadTemplate("boxes/simple.tpl", false, array('secheader' =>
$this->language['recent_clubs'], 'class' => 'blue'), true); ?>

<?php $this->loadTemplate("lists/list_enhanced.tpl", false, array('from' =>
$this->recent_clubs, 'columns' =>
($this->language['title_and_description'])."|".($this->language['photo'])."|
".($this->language['action']), 'widths' => "|70|100", 'indexes' =>
"name|photo|action", 'class' => 'blue'), true); ?>

<?php $this->loadTemplate("boxes/simple_close.tpl", false, array(), true);
?>

 

</div>

 

<?php $this->loadTemplate("divider.tpl", false, array('type' => 'v'), true);
?>

 

<div class="columnSmall">

<?php $this->loadTemplate("boxes/simple.tpl", false, array('secheader' =>
$this->language['members_login'], 'class' => 'grey'), true); ?>

<?php $this->loadTemplate("forms/login.tpl", false, array('form' =>
'login'), true); ?>

<div style="padding-top:5px;padding-bottom:5px;"><?php
$this->loadTemplate("dotted.tpl", false, array(), true); ?></div>

<div style="text-align:center"><a href="index.php?page=forgot"><?php echo
$this->language['forgot_your_password']; ?></a></div>

<?php $this->loadTemplate("boxes/simple_close.tpl", false, array(), true);
?>

 

<?php if ($this->banners['3']): ?>

            <div class="banner-side"><?php build_banner(array('area' =>
'3')); ?></div>

<?php endif; ?>

 

</div>

 

</div>


No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.15.23/1113 - Release Date: 11/6/2007
10:04 AM
 

--- End Message ---
--- Begin Message ---
hello there....is there a way to create a back-up database through PHP?...i 
would like to create a file maybe an sql file that would served as back up 
of my database. Im using mysql database. I know i could use phpmyadmin to do 
this but i just like to have a function that would do this without going to 
phpmyadmin.any help? 

--- End Message ---

Reply via email to