You are here: Re: POST with curl causing Apache to lock up « PHP Programming Language « IT news, forums, messages
Re: POST with curl causing Apache to lock up

Posted by Gordon Burditt on 10/11/18 11:44

>I'm trying to do a POST from one of my PHP pages, to another page on my
>site using curl.
>To maintain the session I'm sending the current session cookie in the
>headers using
>
> $headerArray = array("Cookie: " . session_name() . "=" .
>session_id());

As I recall, PHP locks sessions so the same session can't be used
simultaneously by two different hits in the same session. If it
didn't do this you'd have to lock session variables in individual
PHP pages to avoid getting a mess when two PHP scripts try to update
the same variables simultaneously. (For instance, a per-session
hit counter might lose counts).

Ordinarily, hits from the same session (e.g. the page and associated
images, or the page and several frames, which might also be delivered
by PHP pages) are just delayed. However, if Page A tries to use
PHP to make a hit on Page B on the same server using the same
session, PHP won't start running the Page B code until Page A
finishes running, but Page A won't finish running until Page B is
finished outputting. DEADLOCK!

The only solution I know of is to call session_write_close() in
Page A before starting the hit on Page B. This means you can't
change any session variables in Page A (and have the changes take)
after this point. Another workaround is to NOT try to use the same
session (which may have its own significant problems, like having
to log in with CURL).

Gordon L. Burditt

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация