Go Back   Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum > Support > php issues.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-19-2006, 07:53 PM
Moderator
 
Join Date: Sep 2006
Posts: 629
Send a message via MSN to harry
Default Executive PHP scripts faster.

Guys, I found some of my scripts takes much more time to get execute, how can i increase this execution time for such PHP scripts.
Is there any special utility or code which i can use for faster execution

Last edited by James; 11-20-2006 at 04:52 PM.
Reply With Quote
  #2 (permalink)  
Old 11-19-2006, 08:36 PM
kev woodman's Avatar
Premium Member
 
Join Date: Jul 2006
Location: Newport, Wales, UK.
Posts: 1,494
Default

Check it is the PHP first Harry. Although scripts do take different times to execute we're normally talking milliseconds here so unless you are testing under extremely heavy load you shouldn't notice a difference. If some pages are taking longer than others then odds on it is the HTML etc that is taking the time not the PHP.

If you're sure it is the script then does the script access a database. If it does the problem could lie in the DB rather than the PHP engine. Are you making complex pulls from multiple tables? Are you asking the DB to do some processing before passing the results to your script?

If it's not the DB then there are a few things you can do to improve the performance of the PHP:

* use Zend optimizer;

* cache the output of your scripts;

* have a good look at your code and see if you can cut down on some statements or use tweaks like most likely option first.

As I say though it's almost certainly not PHP that's causing the problem. The project I'm working on at the moment has a section with a gateway page that heavily uses Ajax to carry out CRUD operations on 12 separate DB tables. The controller (PHP) for this page is a big lump of code and at the moment we haven't got any performance issues at all other than the time taken to load the graphics and javascript.
__________________
homo sum: humani nil a me alienum puto ... ( just Google it )
Reply With Quote
  #3 (permalink)  
Old 11-19-2006, 09:00 PM
Moderator
 
Join Date: Sep 2006
Posts: 629
Send a message via MSN to harry
Default

kev, could it be due to a directory of graphics(images) which i m using in my site?
Reply With Quote
  #4 (permalink)  
Old 11-19-2006, 10:52 PM
kev woodman's Avatar
Premium Member
 
Join Date: Jul 2006
Location: Newport, Wales, UK.
Posts: 1,494
Default

If you're loading a lot of graphics onto the page yes. What size (in Kb) are the page graphics?
__________________
homo sum: humani nil a me alienum puto ... ( just Google it )
Reply With Quote
  #5 (permalink)  
Old 11-19-2006, 11:13 PM
Moderator
 
Join Date: Sep 2006
Posts: 629
Send a message via MSN to harry
Default

much varied, some are too heavy and some quite small in size.

Kev, you told : cache the output of your scripts;--- Is it the opcode caching you are talking about.
Reply With Quote
  #6 (permalink)  
Old 11-20-2006, 06:25 AM
kev woodman's Avatar
Premium Member
 
Join Date: Jul 2006
Location: Newport, Wales, UK.
Posts: 1,494
Default

It could be ( have a look at APC or Zend Cache ) or you could use PHPs built-in script caching. Have a look at this article for an introduction.

If you're using a template engine or a framework you may find that there are already caching scripts built-in e.g. Smarty and Cake both have built-in caching.

Another thing I've just thought of - are these scripts 'live' on a remote server or are you testing them on a local machine? If it's on your local machine then I wouldn't be concerned about performance just yet - test them live first.
__________________
homo sum: humani nil a me alienum puto ... ( just Google it )
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:09 PM.
Copyright 2002-2007 WebHosting.uk.com. All rights reserved.
Web Hosting UK Forum