关于网页运行时间过长就会挂掉的问题
因为php要写后台扫描功能,需要扫描服务器上所有的文件(大概100W)左右,这个时候扫描页面可能会运行很久
超过大概1个小时之后 网页会自动挂掉,不再运行,请问论坛里的各位大牛 这个是什么问题?浏览器的?还是什么可以设置成无限运行的模式嘛?
------解决方案--------------------
在页面上加一条:set_time_limit(0);
或者做分页处理了!
------解决方案--------------------
echo ini_get('max_execution_time');
执行这个看看是什么,如果不是0的话那么#1就可以解决
------解决方案--------------------
楼主应该写过处理时间那个,不然怎么会一个小时后才会挂掉
没搞过这么长时间的,不过写成 命令行模式 运行 应该不会挂掉了吧
------解决方案--------------------
那就分页处理吧!(你那些文件应该是有规律的吧)
------解决方案--------------------
这个最好得用php的system()调用系统函数来做吧。不用一直开着php网页。不过linux下权限不大方便,不如用python。
------解决方案--------------------
很有可能内存被吃光了。
尝试释放内存以及unset()相关可疑的变量。
------解决方案--------------------
CGI模式配置不好的话,就有时间限制..5.2就可以用CLI
建议命令行运行,不要从浏览器运行
------解决方案--------------------
估计是对这100W条数据的处理造成的,扫描一小时,完成后一处理把内存占完了,分页是个方法,一次取一百条不够用吗,需要时再去取下一百条

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
