简体   繁体   English

控制PHP中的进程并发

[英]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. 我已编程的简单的应用程序,如果图像中的几个网站和下载它改变每隔X分钟检查。 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... 这非常简单:下载图像标题,进行一些CRC检查,下载文件,将有关每个图像的一些数据存储在MySQL数据库中并处理下一个项目...

This process takes about 1 minute to complete. 此过程大约需要1分钟才能完成。

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. 问题是我注意到服务器执行此过程时,我无法访问网站上的任何页面,即使那些不需要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. 也许更高级的PHP程序员可以为我提供帮助。

I think this is because of session files locks 我认为这是因为会话文件锁定
Try to unset sessions cookie and load page, if I right - page is loaded 如果我正确,请尝试取消设置会话Cookie并加载页面-页面已加载

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 从Web删除执行此脚本是正确的,但是如果有必要,请使用session_write_close()函数关闭会话并解锁会话文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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