Link to home
Start Free TrialLog in
Avatar of qwertq
qwertq

asked on

speed of php5

i am new to php5 and this is my first attempt of using it.

i am really just trying to find out if there are speed differences with php 5 and php 5.  also, does it (5) cache or something? i have noticed weird things in simple class which gets the contents of a directory and does things with it. when i run it the first time it takes 2-11 seconds. then if i refresh the page it will take .1 or less. is this normal? i would think php 5 would be faster.

i have error reporting set to e_all and have fixed anything it says.

also as an fyi: my server (shared environment) by default runs php 4 so you have to name files *.php5 to run under php5
Avatar of Giovanni G
Giovanni G
Flag of Italy image

Not that i'm aware of. If you script is messing file files, it is more probable that your operating system is doing cache.

Have you ever tried on a linux box something like "grep" or "ls" on a busy directory? The first time it take much time, the second time it is faster...
Avatar of qwertq
qwertq

ASKER

can you comment on the speed of php5 vs php4? are there differences?

these two pages are the exact same code. i wrote it for 5, but also saved a duplicate for 4. notice the difference in load time (bottom of page) for the two identical pages. this makes me think it is 5 running slow.

http://www.louiswalch.com/beta/listfile/file.php
http://www.louiswalch.com/beta/listfile/file.php5
it makes no sense such benchmark.. in fact loading the two pages shows different loading times each time. Sometimes .php version is faster than .php5, other times it's the opposite.

anyway, as i suspect that they are both the same php version.. can you add this at the top of them?
<?php print phpversion(); ?>
Avatar of qwertq

ASKER

added. they are different versions. my host runs php 5 under cgi. do you think this could be a cause of the slowness?

i understand the page loads will change somewhat, but i have pretty consistantly been able to confirm the php5 page runs about twice as slow. sometimes more.
ASKER CERTIFIED SOLUTION
Avatar of Giovanni G
Giovanni G
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of qwertq

ASKER

I just got this back from my isp:

"Yes, the slow performance will be caused by running PHP 5 as a CGI.

Unfortunately as of right now we have no plans of upgrading the version of PHP on our shared servers.

If you wish, you may compile your own version of PHP under your account (which we cannot offer any assistance doing) or you may choose to upgrade your account to a dedicated QS hosting package:"

Sucks.... man they need to get with it. Php5 has been out a while. Thanks for the help.
yuck.. did you mention that *only* php5 was ran under CGI? of course, if php4 is ran as apache module it's way faster.. it doesn't have the overhead of spawning another process and computing lots of I/O for each request.

i assumed that both were CGI..

nice to know then, it wasn't nice to know that Zend2 is faster than Zend1.

Regards