CakePHP极其缓慢地加载DebugKit资源 [英] CakePHP loading DebugKit resources extremely slowly

查看:60
本文介绍了CakePHP极其缓慢地加载DebugKit资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用DebugKit在LAMP堆栈上运行cakePHP 2.3.5。

I'm running cakePHP 2.3.5 on a LAMP stack, with DebugKit.

由于某种原因,DebugKit加载的资源(例如js文件,css和小图片)都需要永远加载。

For some reason, the resources loaded by DebugKit (e.g. the js files, css and the small image) are all taking forever to load.

例如无论如何,我在网站上都有一个jquery.js副本,该副本在6毫秒内本地加载。 DebugKit也喜欢加载自己的个人jquery.js,但是根据Chrome的网络分析器,这需要14秒的加载时间!

e.g. I have a copy of jquery.js on the site anyway, which loads locally in 6ms. DebugKit also likes to load it's own personal jquery.js, but according to Chrome's network profiler this takes 14 seconds to load!!

这是debugkit插件目录中唯一的资源

It's only resources within the debugkit plugin directory doing this, everything else is fine.

请注意,在Windows 7上使用XAMPP时,我也没有这个问题,但是由于我将开发转移到LAMP,所以这一直是一个问题。

Note also I do not have this problem when using XAMPP on Windows 7, but since I moved development to LAMP this has been an issue.

有什么想法吗?

推荐答案

Symlink网站资产



请求一个静态文件的时间为14秒-该请求与静态文件不匹配,并由分派过程处理。如文档中的


请记住,通过Dispatcher处理静态资产(例如图像,插件的Javascript和CSS文件)效率非常低

keep in mind that handling static assets, such as images, Javascript and CSS files of plugins, through the Dispatcher is incredibly inefficient

安装任何插件的正常/正确方法是确保所有对插件资产,使用符号链接在网络根目录中点击静态文件:

The normal/correct way to install any plugin is to ensure that all requests for plugin assets, hit a static file in the webroot with a symlink:

App
    Plugin
        DebugKit
            webroot
    webroot
        debug_kit -> ../Plugin/DebugKit/webroot

通过类似于以下命令:

cd App/webroot
ln -s ../Plugin/DebugKit/webroot debug_kit

在Windows上,只需复制文件夹。

On windows, simply copy the folder.

如果有疑问,直接加载是它自己的个人jquery.js (可能是URL / debug_kit / js / jquery.js )并查看结果-在创建符号链接(或复制文件夹)之前和之后。

If in doubt directly load it's own personal jquery.js (probably the url /debug_kit/js/jquery.js) and look at the result - before and after having created the symlink (or copied the folder).

这篇关于CakePHP极其缓慢地加载DebugKit资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆