Solved

speed of php5

Posted on 2006-07-21
7
425 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wordpress type image upload 10 31
Getting info from database not working 6 16
using hash in login 34 20
masking php string 4 10
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now