我是 php web dev 的新手,最近我一直在做一个网站……它在我的本地服务器上运行良好,但是当我把它放在一个实际的服务器上时,它开始运行非常慢,直到它最终放弃了,现在我甚至无法访问该网站..或cpanel ...我一直在做一些研究,认为这可能与sql查询和超载有关,但我似乎找不到任何...
我的网站包含许多对 php 脚本的 javascript 和 ajax 调用,这些脚本从数据库中获取数据......(新通知、消息),我有类似的东西:
//QUESTION RETRIEVAL FOR HOME FEED
$(function(){
$r = setTimeout(alive_retrieval,100);
});
function alive_retrieval(){
$.ajax({
type:"GET",
url:"php/alive_questions.php",
success:function(data){
$("#alive_question.content").html(data);
}
});
$r = setTimeout(alive_retrieval,100);
}
$(function(){
$t = setTimeout(question_retrieval,100);
});
这只是一遍又一遍地调用alive_retrieval函数,我猜这可能会导致我的网站变慢......
我不知道要发布什么来提供帮助(代码,我网站的链接..或w / e)请告诉我我应该给你们什么,这样你们就可以看到发生了什么......
当我转到我的网站地址时,我的托管服务提供商会弹出此错误:
Website you were trying to visit was disabled for 5 minutes, because it received over 20% of total server requests.
It means that this website was using over 20% of processor resources, which is above allowed limit.
Website was temporary disabled to protect server from overloading and other websites on server.