简体   繁体   中英

PHP requests processing in serial not parallel

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?

Yeah you need to use session_write_close() on the cron.php file. session_write_close

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'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM