Re: asynchronous PHP



On Dec 28, 11:44 pm, Lawrence Krubner <lawre...@xxxxxxxxxxx> wrote:

The server I'm working on right now allows PHP scripts to run for 300
seconds.

Which PHP scripts? The ones that are handled by the "Web-based" PHP
interpreter (which could be either an Apache module or CGI/FastCGI
executable) or the ones that are handled by the command-line
interpreter (CLI)? The two PHP interpreters running on the same
machine can be configured differently... Moreover, the CLI has
max_execution_time set to 0 (unlimited) by default:

http://php.net/CLI

I need to get around that.

You probably don't, as command-line scripts are normally allowed
to operate indefinitely, unless they overuse CPU and/or bandwidth.

I'm writing a script that pings the Google Ajax API. The script
is called as a cron job. It needs to make over 100,000 queries
against Google.

How often? Weekly, daily, hourly? The reason I am asking is,
HTTP connections are not established instantaneously. I had a
project where I had to repeatedly ping Yahoo! and I found that
a ping from my ISP's server took about 0.2 seconds on average.
If your situation is similar to mine, your script should take
about six hours to run...

Assuming you need this done daily or less often, here's what
you can do. Write a script that does only a small chunk of
work (say, 100 pings), but remembers what it did last (using a
database, for example). Then, schedule this script to run
every 10 minutes (or every three minutes between midnight and
5 AM).

Cheers,
NC
.



Relevant Pages

  • Re: 72% of web base ping scripts allows attackers to pass malicious parameters
    ... you can ping an internal host ... could run commands of my choice on their server. ... by putting '127.0.0.1 -l' for a host. ... Of all the scripts tested a very frightening 72% allow me to pass ...
    (Vuln-Dev)
  • Re: Interesting webserver intrusion (apache 1.3.31, mod_ssl 2.8.18, php 4.3.7)
    ... since they managed to execute commands via Apache. ... and 30 minutes before one of the scripts was uploaded. ... Sounds like one of the many PHP scripts is exploitable. ... this means that the exploit would allow the attacker to run ...
    (Incidents)
  • Re: PHP Encoders
    ... with the encrypted scripts onto the server to make the scripts ... even faster than unencrypted PHP scripts. ... The ioncube encoder starts at ...
    (php.general)
  • Re: PHP Encoders
    ... with the encrypted scripts onto the server to make the scripts ... even faster than unencrypted PHP scripts. ... The ioncube encoder starts at ...
    (alt.php)
  • Re: PHP Encoders
    ... with the encrypted scripts onto the server to make the scripts ... even faster than unencrypted PHP scripts. ... The ioncube encoder starts at ...
    (comp.lang.php)