Can I do a CURL request to the same server?

Be aware that if you’re issuing the CURL request to your own site, you’re using the default session handler, and the page you’re requesting via CURL uses the same session as the page that’s generating the request, you’ll run into a deadlock situation.

The default session handler locks the session file for the duration of the page request. When you try to request another page using the same session, that subsequent request will hang until the request times out or the session file becomes available. Since you’re doing an internal CURL, the script running CURL will hold a lock on the session file, and the CURL request can never complete as the target page can never load the session.

Leave a Comment