Jump to content

Connection reset


CyJobes

Recommended Posts

I have an app that connects to a source safe server to perform a command via shell_exec(). I had used exec(), but shell_exec seems to work better since I am on Linux.

 

The command connects to the server and tells it to promote a file to the next level. On Windows this ran without a hitch, but on Linux I gat an error that reads:

Socket error when reading request from [172.20.22.1]: 3537808 ; Socket closed.

I am told that the reason for this error is that PHP broke the connection to the server before the server completed the job and was able to shutdown properly.

 

The only way I have found around this is to place a sleep(3) to the script. This is really not ideal since that means that there is at least 3 seconds between each command, which can really extend the time it takes to perform if there are numerous files.

 

If PHP breaks the connection before the program can close it will leave the program open and PHP cannot perform any more commands to the server since it is stuck on the last command. If too many are given the machine will lock up due to resources being eaten up.

 

I'm wanting to know if there is a way to tell PHP to not let go of a connection so quickly.

 

I tried "nohup", but that does not help.

 

I am new to Linux and am at a loss of what my options are beyond the sleep() method. I really feel that there has to be a better way or setting that can be manipulated to fix this issue altogether.

 

Thanks in advance for any help.

 

Cy

Link to comment
https://forums.phpfreaks.com/topic/233724-connection-reset/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.