Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I PREVENT TIMEOUT ? 1

Status
Not open for further replies.

ruffy

Programmer
Oct 1, 2003
72
US
Running on my own computer/server, I'm running into the problem of timing out.

I've tried set_time_limit(999999999) and have similarly updated the PHP.INI file - but the system seems to ignore these limits.

Looking for a helpful idea. Thanks.
 
Yes, sorry my typing was to blame there. When you get odments like this run under the command line to see what is going on without the web server getting in the way.
 
Sorry to say - You lost me.
I looked up lots of sites for help but the geeky knowhow just blow me away.

I know my version of PHP is CGI related (php4.3.1).
I know to put #!/path at the start of my "script" file (I called it "myScript.php"; That's the one that does the array work).
I know to put my script file outside the browser's reach; So I just laid it down in C:.

I do not know how to tell the task manager, "Run c:\progra~1\php\php.exe and point to this script.

Nor do I know what "exec()" has to do with all this and where or how to code this one liner.
 
ruffy:
I assume your last post was directed at me.

My solution is that the script at which you point your web browser (the "launcher") will spawn a task independent of the web script (the "processor"). It will simply schedule the data-processing script to run and will do so using the server's scheduling service.

Your launcher script needs to externally invoke the Win32 "at" command to schedule the run of the processor script.

Here's an example of a processor script. It doesn't do much:

Code:
<?php
$fh = fopen ('c:\php\foo.txt', 'w') or die ("Could not open output file");

fputs ($fh, 'This is a test');

fclose ($fh);
?>

And here is its associated launcher:

Code:
<?php
$hour = date ('G');
$minute = date ('i');
$minute += 2;

$exec_string = 'at ' . $hour . ':' . $minute . ' c:\php\php.exe c:\php\processor.php';

$foo = exec($exec_string);

print $exec_string;
print $foo;
?>

It gets the current hour and minute, adds two minutes to the minute stamp, constructs a string which, when executed, schedules the processor script to run using the Win32 scheduler service




Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Hey Sleipnir214
First of all - I thank you for your time.
I hope it's no bother to you, but I keep getting "Access is denied."

I'm on WIN2000. I tried giving executable permissions to "script and executables" but that didn't work.
Might you know how to specifically overcome this problem?

My files are called "launcher.php" and "processor.php".
Does it matter where they reside? It didn't seem so.
 
I recommend you check permissions on the file. At the very least, the user as which your web server runs must be able to read and execute the file.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
sleipner214 - Hi.
I always log on as administrator.
I ran in the DOS window (in the directory where both files launcher.php and processor.php reside) as follows:
cacls launcher.php /G administrator:F
It asked: Are you sure?
I said Y.
And I did the same for processor.php.

Then I pointed my browser to and the response again came back "Acess denied".
 
My MS Management Console shows, under Master properties, under Directory Security, that I allow anonymous access with the default anonymous Internet user account IUSR_HP. I suppose this name is what you're asking for when you ask what the server's running as - is it?

So, again, I ran in the DOS window (in the directory where both files launcher.php and processor.php reside) as follows:
cacls launcher.php /G IUSR_HP:F
cacls processor.php /G IUSR_HP:F
cacls c:\progra~1\php\php.exe /G IUSR_HP:F

but I still have Access Denied.
What am I doing wrong?
 
IIS is a service. All services, when they run, "log in" to the system on which they run. Everything that service does on your system, it does as that user. Look at the properties of your and see as which user it logs onto the system.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
That's what I did - as my previous message suggested.

IIS shows a Master Properties listing of There, when I edit that item, many tabbed panes come up; One of them, Directory Security, shows that I allow anonymous access with the default anonymous Internet user account IUSR_HP.

Now, is not what I did, as described in my previous message (please look), with the name IUSR_HP, not correct?
 
Check also the properties of the service itself. As what user does it log into the system?

If may be that IIS doesn't use a specific login, in which case IUSR_[MACHINENAME] is your best choice.


But an "Access Denied" message isn't very helpful debugging. What do your server logs say?



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
IS MY CACL COMMAND THE ONE I WILL EVENTUALLY USE?

IUSR_HP is the non-specfic IUSR_[MACHINENAME]; I run an HP box!

I can't find where the bloody log files lay.
I checked in System Tools --> Event viewer, where 3 directories (Application, Security, and System) contain logs - but not any related to Access Denied following my cacls commands.

I hope you'll eventually be able to help me.
 
I don't know if cacl is the only command you will eventually use.



Look in your web site's configuration. There is a setting for logging. Where does that configuration option point?



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
In WINNT\SYSTEM32\LOGFILES
there's this I found.

#Software: Microsoft Internet Information Services 5.0
#Version: 1.0
#Date: 2004-06-24 21:00:14
#Fields: date time c-ip cs-username s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status cs(User-Agent)
2004-06-24 21:00:14 127.0.0.1 - 127.0.0.1 80 GET /codes/processing/launcher.php - 200 Mozilla/5.0+(Windows;+U;+Windows+NT+5.0;+en-US;+rv:1.6)+Gecko/20040206+Firefox/0.8
2004-06-24 21:13:54 127.0.0.1 - 127.0.0.1 80 GET /codes/processing/launcher.php - 200 Mozilla/5.0+(Windows;+U;+Windows+NT+5.0;+en-US;+rv:1.6)+Gecko/20040206+Firefox/0.8
2004-06-24 21:17:07 127.0.0.1 - 127.0.0.1 80 GET /codes/processing/launcher.php - 200 Mozilla/5.0+(Windows;+U;+Windows+NT+5.0;+en-US;+rv:1.6)+Gecko/20040206+Firefox/0.8
 
What do you mean by, "outside of IIS". Do you mean execute it without use of the browser?

Can you show me an example of how I would run launcher.php ?
 
If you're running PHP as a CGI, there will be a standalone PHP interpreter on your system. The executable should be php.exe.

If you have a script foo.php, you can, from a command prompt, run:

[drive]:\path\to\php.exe [drive]:\path\to\foo.php

to execute the script.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top