简体   繁体   中英

Control process concurrency in PHP

I have programmed a simple app that every X minutes checks if an image has changed in several websites and downloads it. It's very simple: downloads image header, make some CRC checks, downloads the file, stores in a MySQL database some data about each image and process next item...

This process takes about 1 minute to complete.

The problem is I have noticed that while the server is executing this process I cannot access to any page in the website, even those that don't require MySQL.

I don't know why it is happening and I have no clue about how to fix it. Perhaps a more advanced PHP programmer can help me.

I think this is because of session files locks
Try to unset sessions cookie and load page, if I right - page is loaded

It would be correct to remove execute this script from web, but if this is necessary, use session_write_close() function to close session and unlock session file

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