Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop cURL from deadlocking my PHP session?

Tags:

php

curl

session

So basically, I am using cURL to call APIs that I can't implement natively in PHP. When I make a call though, it deadlocks my PHP session. I cannot connect to my website from another tab in my browser. If I delete the session cookie, I can connect fine. Before, when I didn't have a timeout in cURL, this would last indefinitely.

Is this just how the PHP implementation of cURL works, or is there a way around it?

like image 246
NobleUplift Avatar asked Mar 04 '26 12:03

NobleUplift


1 Answers

As mentioned here, you might want to try to do the cURL request without having the session open, e.g. by doing session_write_close() before sending the request and session_start() after you've handled it.

like image 140
thejh Avatar answered Mar 07 '26 03:03

thejh