• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

executing php from shell

which one execute a php script fast?
a) shell using php -f script.php
b) using http as http://site.com/script.php

the script does a lots of database inserts and take lot of time to execute
which method gives less load to the server?
thanks in advance
0
sree01
Asked:
sree01
4 Solutions
 
dineeshCommented:
Hi,

The first method is faster.

regards
DInesh
0
 
louislietaerCommented:
I thinks method a). But I don't think it will make a big difference.

To improve your script performance you will have to work on sql queries

you can also nice your process

nice 'php -f script.php' 10 & 

This will give a low priority to your script an give more system ressource to other applications.
You can go to up to 20 as Parameter value.
0
 
shobinsunCommented:
Hi,

The first method is little bit faster.

And follow the link below to speed up your php script:

http://reinholdweber.com/?p=3

Regards
0
 
jbristleCommented:
The shell will run with slightly less resource usage.
If your script takes an excessive time to execute, you may receive a timeout by accessing it through the web server without a timeout change.

If your script does not take any input, variables, etc.., you should probably consider just dumping the table to a text file and execute it through the sql client. That is unless you do not have access to the client or you need it to be as simple as possible.


0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now