user1949616
user1949616

Reputation: 45

Close window STOP php script?

I have tried searching for this forever, but unfortunately I could not find the answer. I am calculating a whole lot of Pearson correlations on huge matrixes on my server. I do this by opening example.org/testscript.php.

The script itself will terminate about a 2 days after it has started and will perform many INSERT INTO databases for recommendation purposes.

I was wondering when I closed the window of my browser, whether the PHP script would stop or not. I am assuming not; however I am not a 100% sure.

P.S. I have noticed that in some browsers on some computers I will receive an internal server error (500) when starting the script after about 10 minutes. The script itself however was still running as it was still inserting rows in my database.

On this computer however I have not received such error and therefore I was wondering what would happen when I closed the tab.

Upvotes: 3

Views: 1706

Answers (1)

Alen Oblak
Alen Oblak

Reputation: 3325

The php script will terminate after reaching the timeout. You can change the timeout: http://php.net/manual/en/function.set-time-limit.php

The browser will however timeout much sooner, if you are not producing any output. The browser timeout is of course browser-specific.

As Dagon suggested, the correct way would be to execute the php script on the server in the background.

Upvotes: 4

Related Questions