Jump to content

Script killed


jaymc

Recommended Posts

Hey, Im running an php msn bot

 

My problem is that it loses connection after around 20 seconds. I have spoke with the developer of this and he says it works fine on 90% of servers

 

He has advised that the script is being terminated by the OS / php

 

My question is, what has the power to automatically kill a php script. I have checked php.ini and things such as max_execution_time , set_time_limit are both 10 minutes

 

What other settings control when and if to terminate a php script that it thinks has been running too long

Link to comment
Share on other sites

20 seconds is a lot for a webpage. I don't know the exact timeout of browser but some will eventually report a timeout if your expect your script to run for more than 20 seconds. I don't think most visitor will wait that long.

 

If your building a bot or want to run a background job you should check for a cron job instead. Just ask google about crontab/cron job you will find a lot of ressource on how to set a job to run on background at regular interval.

 

I don't know about your environement at all but some shared hosting may have installed something to shut the script after some time. Or it may be the memory requirement that kill the script.

Link to comment
Share on other sites

I have tried it on two different servers

 

One which is behind my own router

another which is in a datacenter

 

Both get killed after 15 seconds, tried with firewall off too

 

Yes it does use fsocket but isnt setting the timeout based on if it cant get a connection as apposed to keeping it running for more than 15 seconds?

Link to comment
Share on other sites

I only have one php.ini file

 

Here are the key settings

 

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 3600     ; Maximum execution time of each script, in seconds
max_input_time = 6000   ; Maximum amount of time each script may spend parsing request data
memory_limit = 3024M      ; Maximum amount of memory a script may consume (16MB)

; Default timeout for socket based streams (seconds)
default_socket_timeout = 3600

; Maximum size of POST data that PHP will accept.
post_max_size = 2048M

; Maximum allowed size for uploaded files.
upload_max_filesize = 2048M

 

I have also tried running it from the browser as apposed to ssh

Any more ideas?

Link to comment
Share on other sites

Hi

 

There are no errors. The msn bot will function perfectly but goes offline after 20-30 seconds. When that happens it is no longer in ps aux

 

The guy who made it said he has heard of this issue from other people who use the bot but assures it works fine on systems he has tested which include windows/linux

 

Hence, he believes enviroment issue such as php.ini setting / operating setting

Link to comment
Share on other sites

Correct

 

The bot signs into msn, stays online for 20 seconds

 

If you send it messages it will function as expected as in return messages back to you

 

Strangely, by talking to it this causes it to stay online, until you stop talking

 

Perhaps because the socket is active

 

But no errors, just a general timeout kind of thing when there is no communication to the bot from an msn user

Link to comment
Share on other sites

I bet what's happening is there's a timeout from MSN on the socket. Clasically, In order to keep a socket alive you need to send a NOOP (or similar.)

 

I think the extensive testing the author told you about was on a really active bot ;)

Link to comment
Share on other sites

The fact that you're not getting an error is what's troubling me still. Are you familiar with XDebug? If you could run it through the debugger to find out where it's exiting it could give more information.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.