PHP文件缓存VS通过htaccess的缓存缓存、文件、PHP、VS

2023-09-02 09:39:26 作者:我会爱你何必!

我是一个共享的服务器上,作为东道主的公司安装了一个新的进程,杀死占用过多内存的任何过程中,有很多我的内置页框在我的页面没有加载。我有一个最多有三个PHP页面内置页框在其中的PHP页面,我结束了与二三个内置页框的出现OK,一个抛出code 500页。 (不知道是否是杏1G内存,因为它击中PHP 4次,一次为主页,三个次,每次IFRAME,还是什么?)

I am on a shared server and as the host company has installed a new process that kills any process that uses too much memory, a lot of my iframes in my pages are not loading. I have php pages that have up to three php page iframes in them and I am ending up with two out of the three iframes appearing OK and one throws a code 500 page. (Not sure whether it is maxing out 1G memory because it is hitting php 4 times, once for the main page and three more times for each iframe, or what??)

第一层支持的人的反应是买一个升级包。我们去来回一段时间之前,他踢了到二级支持的家伙。他看着事情了,建议我实现页面缓存到我的code。我研究这进一步倾向于同意这种解决方案比之前的建议。

The response of the first tier support guy was to "buy an upgrade package". We went back and forth for a while before he kicked it up to tier two support guy. He looked things over and suggested that I implement page caching into my code. I researched this further and tend to agree with this solution more than the prior suggestion.

我就开始实行简单的解决方案,在这里张贴在stackflow在Supersimple静态文件的基础(HTML)PHP站点缓存,希望这将这样的伎俩。我已经修改了这个code在几个地方适合我的网站,并要求和它的作品,但仍然还没有想出如何停止从缓存父页时,内置页框之一抛出一个code 500,但这不是我在这里的主要问题。 (当然,如果有人确实有一个快速的答案,我不会抱怨。)

I started to implement a "simple solution" that was posted here on stackflow at Supersimple static file based (html) php site cache which will hopefully do the trick. I have modified this code in several places to fit my site and requirements and it works, but still haven't figured out how to stop the parent page from caching when one of the iframes throws a code 500, but this is not my main question here. (Of course if someone does have a quick answer to this, I will not complain.)

我看着通过的htaccess做页面缓存作为更有效,因为它会检查缓存开拓PHP页面之前,也更容易做修改每个文件的一站式位置代替。我有htaccess的高速缓存的问题是,我使用基于文件修改的最后一次缓存,最多(150 +)基于一个单独的主数据文件,其他几个人基于其他个人数据文件,以及一些基于对缓存自己的mod时文件的mod时间。所有的PHP文件,所以我不知道我是否可以使用htaccess的覆盖与一批文件具有相同后缀的对比情况?我的问题今天是这是可能的,而且可行的,或者我应该在每个PHP文件坚持与粘贴的code,以保持特定的时间比较直接的因素?

I looked at doing page caching through htaccess as being more efficient because it checks cache before opening up the php page, and easier to do in a one stop location instead of modifying each file. The problem I do have with htaccess cache is that I am using caching based on last time of file modification, most (150+) based on a separate master data file, a few others based on other individual data files, and a few based on their own mod time against cache file mod time. All are php files so I am not sure if I can use htaccess to cover all comparison situations with a batch of files with the same extension? My question here today is is this possible, and workable, or should I stick with the pasting the code in each php file so as to keep the specific time comparison factors straight?

感谢您的时间和想法......斯坦......

Thanks for your time and thoughts...Stan...

推荐答案

我会建议做的是试图减少你的code中的内存使用的第一件事情。尝试使用分析器,如XDebug的分析它在做什么以及它需要进行优化。

The first thing I'd suggest doing is trying to cut down the memory usage of your code. Try using a profiler such as XDebug to analyse what it's doing and where it needs to be optimised.

缓存将帮助(也许是一个好主意无论如何),但它不会解决根本问题。

Caching will help (and might be a good idea anyway), but it won't solve the underlying problem.

 
精彩推荐
图片推荐