Solved

speed of php5

Posted on 2006-07-21
7
428 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:qwertq
  • 4
  • 3
7 Comments
 
LVL 14

Expert Comment

by:ThG
ID: 17159528
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...
0
 

Author Comment

by:qwertq
ID: 17160262
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
0
 
LVL 14

Expert Comment

by:ThG
ID: 17161111
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(); ?>
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:qwertq
ID: 17161257
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.
0
 
LVL 14

Accepted Solution

by:
ThG earned 125 total points
ID: 17161656
you are right, it definitely looks that on the avarage the php4 version runs faster.

unfortunately i think i won't be able to help you. I don't know in detail internal Zend2 changes respect Zend1. Maybe if you don't mind posting the source code, we might track down a particular construct or system call that is causing this.

this would be anyway a step-by-step procedure, benchmarking each block of code with some loops.
0
 

Author Comment

by:qwertq
ID: 17162996
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.
0
 
LVL 14

Expert Comment

by:ThG
ID: 17163814
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
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question