Yeah you need to use session_write_close()
on the cron.php file. session_write_close
PHP requests processing in serial not parallel
Question
I wrote a page (cron.php
) that uses the imap library to connect to a mailbox, parse messages, and store them in a database, then echo
s the results in json. I have a few dozen mailboxes that I need to run this same process for, and so I put together a page (mailboxes.php
) that lists all these accounts, each with a button that when clicked, essentially hits cron.php
via AJAX and parses the json response to update the page when the process is completed.
I've noticed however that if I click each of these boxes, they return as if running serially, not in parallel. Is there a configuration option someplace that might explain this?
Solution
OTHER TIPS
Are you using sessions? Every time you run session_start
for given session, it is being locked, until the script finishes, or the session is being 'detached'.