为什么我的网站在我的本地主机上加载速度慢但在实际网站上没有?

时间:2023-01-21 09:01:21

I am currently developing a site on my localhost, using mamp, which I then push up to the live site using git. Here is my question. When I refresh the page on my localhost it takes up to a minute to load the page again. When I refresh the page on the live site it refreshes almost instantly. On each refresh it does a couple database queries, but nothing big.

我目前正在使用mamp在我的localhost上开发一个站点,然后我使用git将其推送到实时站点。这是我的问题。当我刷新本地主机上的页面时,再次加载页面需要一分钟。当我刷新现场网站上的页面时,它几乎立即刷新。在每次刷新时,它会执行几个数据库查询,但没什么大不了的。

I am using a mysql database, a codeigniter framework, and my site is hosted by Hostgator.

我使用的是mysql数据库,一个codeigniter框架,我的网站由Hostgator托管。

Thanks!

1 个解决方案

#1


0  

First of all, let me say that this is impossible to answer without a lot more information. That being said, my best guess would be that your local MAMP installation doesn't have as much memory allocated as your actual web server. The amount of RAM PHP has access to can be modified in your php.ini file or using ini_set("memory_limit","256M");

首先,让我说如果没有更多的信息,这是不可能回答的。话虽这么说,我最好的猜测是你的本地MAMP安装没有像实际的Web服务器那样分配的内存。可以在php.ini文件中或使用ini_set(“memory_limit”,“256M”)修改PHP访问的RAM量;

However, if your host machine doesn't have a lot of RAM to begin with, then this probably won't make a difference...

但是,如果你的主机没有很多RAM开始,那么这可能不会有所作为......

#1


0  

First of all, let me say that this is impossible to answer without a lot more information. That being said, my best guess would be that your local MAMP installation doesn't have as much memory allocated as your actual web server. The amount of RAM PHP has access to can be modified in your php.ini file or using ini_set("memory_limit","256M");

首先,让我说如果没有更多的信息,这是不可能回答的。话虽这么说,我最好的猜测是你的本地MAMP安装没有像实际的Web服务器那样分配的内存。可以在php.ini文件中或使用ini_set(“memory_limit”,“256M”)修改PHP访问的RAM量;

However, if your host machine doesn't have a lot of RAM to begin with, then this probably won't make a difference...

但是,如果你的主机没有很多RAM开始,那么这可能不会有所作为......