-2

On PHP im using curl or file_get_contents to download a big file it takes about 30sec to 10min and then saving it to the server, but during the download time i can not ask for a new request, i try a new php request but it didnt load until the last php script/download is over.

if i open the same site on another web explorer it work normaly.

Thx

  • Your problem has two parts, neither of which php is very strong for. First, processing in the background after returning a message to the browser: http://stackoverflow.com/questions/15273570/continue-processing-php-after-sending-http-response. The second part of the problem is notifying your client when the processing is finished. With php that probably means polling the server to see if the file is ready. If Javascript is an option , you can use that to make the file request without blocking the regular operation of the browser. – Jerry Dec 15 '16 at 21:57
  • Does your script use session variables? By default only one script can be running in the same session at a time. You need to close the session before you make the long `curl` request to allow another script to use the same session. – Barmar Dec 15 '16 at 22:01
  • yeah im using sessions, php sessions – Xelhua Joseph Corona Pérez Dec 16 '16 at 00:22
  • i ll use session_write_close after i ended with session data to unlock the sessions. Thx for the comments! – Xelhua Joseph Corona Pérez Dec 16 '16 at 00:24

1 Answers1

0

PHP session is locked to prevent concurrent writes. U need to close the session to start a new script that use sessions.

Ill use session_write_close to close it after i recollect or update the data i needed.

Thx!