php-general Digest 27 Mar 2007 11:27:28 -0000 Issue 4700

Topics (messages 251432 through 251443):

Re: Performance: While or For loop
        251432 by: Jake Gardner
        251434 by: Travis Doherty
        251437 by: Tijnema !

short open tags not working even if enabled - lighttpd + fastcgi
        251433 by: Matt Arnilo S. Baluyos (Mailing Lists)
        251435 by: Tim
        251438 by: Tijnema !
        251439 by: Colin Guthrie
        251441 by: Jochem Maas

Re: PHP newbie question on xslt
        251436 by: "Miguel J. Jiménez"

Smarty Website down?
        251440 by: Mario Guenterberg
        251443 by: itoctopus

Re: Optimization of all mysql databases on a server
        251442 by: Jochem Maas

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
He said if you run the /script/ itself 1000 times, not a loop with 1000
iterations. This is quite possible; I am fairly certain there are websites
out there that get accessed well over 1000 times a minute, yes?

So every minute, that website is saving a total of 2.6 seconds to do...
whatever it is websites do in their free time.

In reality, scripts rarely get executed once and then are deleted; they are
used repetitively, and the more a script is used, the more significant the
gain. Claiming to look practically on a small gain /within one execution of
a script/ is impractical in itself.

On 3/26/07, Richard Lynch <[EMAIL PROTECTED]> wrote:

On Sat, March 24, 2007 4:52 am, Tijnema ! wrote:

>> That means that at 1000 iterations, you are "saving" how much time?
>>
>> .00026 seconds?
>> .00004 seconds?
>>
>> Puhleaze.
>
> Well, if you execute this script 1000 times, you would get a
> difference of 2.6 seconds?
> But if every microseconds counts for your script, then you should now
> about this.

No.

Re-read the benchmards.

At 1000 iterations you're looking at .000xx seconds.

At a MILLION iterations, you're looking at 0.xx seconds

At a TEN MILLION iterations, you've broken the 1-second barrier.

How many PHP scripts do a for or while loop 10 million iterations?

xx is either 26 or 4, depending on whose benchmarks you believe.

Running tests with 10 million iterations to benchmark is great for
removing overhead margin of error.  It's also great to look at exactly
how many times you'd have to do something to make a significant
savings.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



--- End Message ---
--- Begin Message ---
Jake Gardner wrote:

> He said if you run the /script/ itself 1000 times, not a loop with 1000
> iterations. This is quite possible; I am fairly certain there are
> websites
> out there that get accessed well over 1000 times a minute, yes?
>
> So every minute, that website is saving a total of 2.6 seconds to do...
> whatever it is websites do in their free time.
>
> In reality, scripts rarely get executed once and then are deleted;
> they are
> used repetitively, and the more a script is used, the more significant
> the
> gain. Claiming to look practically on a small gain /within one
> execution of
> a script/ is impractical in itself.

I still wouldn't go around telling people to re-write all of their code
to use for loops instead of while loops (or whatever was faster for
whatever architecture.)

Keep in mind that .000xx seconds in performance improvement certainly
does make a difference on a site that is accessed millions of times a
day, however, one bug caused by writing code that reads poorly instead
of writing clean code can cost a *lot* more in the end.

- Use what reads easier when deciding if a for/while loop is best.
- Profile your code and find the right places to optimize.

Optimizing code that takes .0001 seconds to run down to .00001 seconds
is great, 10x improvement!  Who cares. Find the chunk that takes 0.5
seconds to run and optimize that to 0.05 seconds. 10x improvement still,
except that this time it actually makes a practical difference.

Travis Doherty

--- End Message ---
--- Begin Message ---
On 3/27/07, Travis Doherty <[EMAIL PROTECTED]> wrote:
Jake Gardner wrote:

> He said if you run the /script/ itself 1000 times, not a loop with 1000
> iterations. This is quite possible; I am fairly certain there are
> websites
> out there that get accessed well over 1000 times a minute, yes?
>
> So every minute, that website is saving a total of 2.6 seconds to do...
> whatever it is websites do in their free time.
>
> In reality, scripts rarely get executed once and then are deleted;
> they are
> used repetitively, and the more a script is used, the more significant
> the
> gain. Claiming to look practically on a small gain /within one
> execution of
> a script/ is impractical in itself.

I still wouldn't go around telling people to re-write all of their code
to use for loops instead of while loops (or whatever was faster for
whatever architecture.)

While loops came out faster :)

Keep in mind that .000xx seconds in performance improvement certainly
does make a difference on a site that is accessed millions of times a
day, however, one bug caused by writing code that reads poorly instead
of writing clean code can cost a *lot* more in the end.

- Use what reads easier when deciding if a for/while loop is best.
- Profile your code and find the right places to optimize.

Optimizing code that takes .0001 seconds to run down to .00001 seconds
is great, 10x improvement!  Who cares. Find the chunk that takes 0.5
seconds to run and optimize that to 0.05 seconds. 10x improvement still,
except that this time it actually makes a practical difference.

Travis Doherty

I'm not telling people to rewrite the code, but if you need to choose,
and both are good for the job, choose while :)

Tijnema


--- End Message ---
--- Begin Message ---
Hello everyone,

I have a working lighttpd + fastcgi + PHP + eaccelerator installation.
I have also enabled short tags on the /usr/local/lib/php.ini but I'm
having problems with PHP not escaping the short tags.

To better illustrate, my phpinfo() file can be accessed at
http://202.171.164.70/phpinfo.php - if you notice short_open_tag is
set to "On".

But when you access a PHP page at
http://202.171.164.70/admin/login.php and try to view the source, the
short open tag is not escaped.

Any reason why this isn't working as expected?

Regards,
Matt

--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

--- End Message ---
--- Begin Message ---
Matt Arnilo S. Baluyos (Mailing Lists) schrieb:
Hello everyone,

I have a working lighttpd + fastcgi + PHP + eaccelerator installation.
I have also enabled short tags on the /usr/local/lib/php.ini but I'm
having problems with PHP not escaping the short tags.

To better illustrate, my phpinfo() file can be accessed at
http://202.171.164.70/phpinfo.php - if you notice short_open_tag is
set to "On".

But when you access a PHP page at
http://202.171.164.70/admin/login.php and try to view the source, the
short open tag is not escaped.

Any reason why this isn't working as expected?

Regards,
Matt

Hi,

maybe it's because of the whitespace after the <?.

Try this:
<?=$_SERVER['PHP_SELF']; ?>

Best regards,
Tim

--- End Message ---
--- Begin Message ---
On 3/27/07, Matt Arnilo S. Baluyos (Mailing Lists)
<[EMAIL PROTECTED]> wrote:
Hello everyone,

I have a working lighttpd + fastcgi + PHP + eaccelerator installation.
I have also enabled short tags on the /usr/local/lib/php.ini but I'm
having problems with PHP not escaping the short tags.

To better illustrate, my phpinfo() file can be accessed at
http://202.171.164.70/phpinfo.php - if you notice short_open_tag is
set to "On".

But when you access a PHP page at
http://202.171.164.70/admin/login.php and try to view the source, the
short open tag is not escaped.

Any reason why this isn't working as expected?

Regards,
Matt

You also use XML in your page, and thereby i would NOT recommend using
short tags. as xml tags also start with <?

Better learn to start PHP tags with <?php and disable the short tags.
This way i cannot ever give problems with the <?xml tags.s

Tijnema

--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

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



--- End Message ---
--- Begin Message ---
Matt Arnilo S. Baluyos (Mailing Lists) wrote:
> Hello everyone,
> 
> I have a working lighttpd + fastcgi + PHP + eaccelerator installation.
> I have also enabled short tags on the /usr/local/lib/php.ini but I'm
> having problems with PHP not escaping the short tags.
> 
> To better illustrate, my phpinfo() file can be accessed at
> http://202.171.164.70/phpinfo.php - if you notice short_open_tag is
> set to "On".
> 
> But when you access a PHP page at
> http://202.171.164.70/admin/login.php and try to view the source, the
> short open tag is not escaped.
> 
> Any reason why this isn't working as expected?

If I've understood correctly, short tags are the spawn of the devil and
will be purged from this earth when PHP 6 reigns supreme ;)

Col.

--- End Message ---
--- Begin Message ---
Matt Arnilo S. Baluyos (Mailing Lists) wrote:
> Hello everyone,
> 
> I have a working lighttpd + fastcgi + PHP + eaccelerator installation.
> I have also enabled short tags on the /usr/local/lib/php.ini but I'm
> having problems with PHP not escaping the short tags.

either you stopped using short php tags, there is no problem or you fixed
it somehow. no?

> 
> To better illustrate, my phpinfo() file can be accessed at
> http://202.171.164.70/phpinfo.php - if you notice short_open_tag is
> set to "On".
> 
> But when you access a PHP page at
> http://202.171.164.70/admin/login.php and try to view the source, the
> short open tag is not escaped.

what does 'is not escaped' mean?

> 
> Any reason why this isn't working as expected?
> 
> Regards,
> Matt
> 

--- End Message ---
--- Begin Message ---
Timothy Murphy escribió:
I've been trying some of the programs
in the PHP manual at <http://www.php.net/manual/en/>
in chapters CLXXXI and CLXXXII to work, for example
----------------------------
// Example 2519. Creating an XSLTProcessor

<?php

$xml_filename = "collection.xml";
$xsl_filename= "collection.xsl";

$doc = new DOMDocument();
$xsl = new XSLTProcessor();

$doc->load($xsl_filename);
$xsl->importStyleSheet($doc);

$doc->load($xml_filename);
echo $xsl->transformToXML($doc);

?>
----------------------------
(where I have added the two filenames,
and copied the files collection.x?l from the manual).

When I run PHP I get:
----------------------------
[EMAIL PROTECTED] Test]# php ex2519.php
// Example 2519. Creating an XSLTProcessor

Segmentation fault
----------------------------

I'm running the program under Fedora-6 Linux
with the latest versions of all programs.

Is there something I should have included,
to get the program to run?

Any advice or suggestions gratefully received.


Try not to load both xml and xsl in the same $doc variable... use one for the xsl and another for the xml. I think you are destroying the dom for the xsl before the transform...

--
Miguel J. Jiménez
Área de Internet/XSL/PHP
[EMAIL PROTECTED]

----------------------------------------------------

ISOTROL
Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.
Parque Tecnológico Cartuja '93, 41092 Sevilla.
Teléfono: 955 036 800 - Fax: 955 036 849
http://www.isotrol.com

"Killing is often a part of life. What's hypocritical is to condemn, and then make 
allowances when the situation suits."
Utu-Noranti Pralatong (Farscape 4x17 - A Constellation Of Doubt)


--- End Message ---
--- Begin Message ---
Hi...

I try to connect in the last hours and the results are timeouts.

Greetings
Mario

-- 
 -----------------------------------------------------
| havelsoft.com - Ihr Service Partner für Open Source |
| Tel:  033876-21 966                                 |
| Notruf: 0173-277 33 60                              |
| http://www.havelsoft.com                            |
|                                                     |
| Inhaber: Mario Günterberg                           |
| Mützlitzer Strasse 19                               |
| 14715 Märkisch Luch                                 |
 -----------------------------------------------------

--- End Message ---
--- Begin Message ---
looks ok now

--
itoctopus - http://www.itoctopus.com
"Mario Guenterberg" <[EMAIL PROTECTED]> wrote in message
news:20070327092337.GA24779@/bin/dnsdomainname...
Hi...

I try to connect in the last hours and the results are timeouts.

Greetings
Mario

--
 -----------------------------------------------------
| havelsoft.com - Ihr Service Partner für Open Source |
| Tel:  033876-21 966                                 |
| Notruf: 0173-277 33 60                              |
| http://www.havelsoft.com                            |
|                                                     |
| Inhaber: Mario Günterberg                           |
| Mützlitzer Strasse 19                               |
| 14715 Märkisch Luch                                 |
 -----------------------------------------------------

--- End Message ---
--- Begin Message ---
Tijnema ! wrote:
> On 3/26/07, Chris <[EMAIL PROTECTED]> wrote:
>> itoctopus wrote:
>> > The purpose of this script is to optimize all associated tables in all
>> > databases on a mysql server. This script is working great, you can
>> put in a
>> > CRON and run it every day. Feel free to throw in your 2 cents!
>>
>> It's going to time out if you have any large databases or tables.

php will not timeout on the commandline unless you actually specify
a timeout - unlike php as used as a webserver SAPI.

> 
> What about set_time_limit(999999)??

RTFM: set_time_limit(0);

although it's not needed.

> 
>>
>> Also a much easier option is to run
>>
>> mysqlcheck -o ...

indeed - use the right tool for the job.

> 
> That's true :)
> 
> Tijnema
>>
>> -- 
>> Postgresql & php tutorials
>> http://www.designmagick.com/
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 

--- End Message ---

Reply via email to