由于使用文件系统路径,Magento 管理 CSS 丢失

发布于 2024-12-22 00:07:08 字数 1611 浏览 2 评论 0原文

我无法使用 Magento Connect 安装模块,出现连接错误稍后重试错误。按照模块开发人员的说明,我尝试修复文档根目录中的权限:

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod o+w var var/.htaccess app/etc
chmod 550 mage
chmod -R o+w media

它仍然不起作用,所以我最终手动安装了模块。然后我登录到管理后端,Magento 尝试使用系统文件路径而不是 URL 来提供 CSS 文件,如下所示:

<link rel="stylesheet" type="text/css" href="/home/user/public_html/js/calendar/calendar-win2k-1.css" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/reset.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/boxes.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/custom.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/xmlconnect/boxes.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/menu.css" media="screen, projection" />

我立即删除了扩展名,并尝试将另一台服务器的权限与正在运行的 Magento 进行匹配,但无济于事。我还:

  • 清除本地、APC 和 Magento 缓存
  • 查看错误日志(已启用日志记录)
  • 仔细检查数据库中 web/unsecure/base_url 和 web/secure/base_url 的正确值
  • 重新启动,3 次;)

Minify 不是被使用。合并 CSS 文件已启用,但是我无法弄清楚如何在没有管理界面的情况下禁用它(即使我用 Firebug 替换了正确的值,保存和导航也不起作用)。任何想法将不胜感激!

I was unable to install a module using Magento Connect, getting a Connection Error try again later error. Following the instructions of the module developer I attempted to fix permissions in the document root with:

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod o+w var var/.htaccess app/etc
chmod 550 mage
chmod -R o+w media

It still didn't work so I ended up installing the module manually. I then logged into the admin backend and Magento was trying serve CSS files using the system file paths instead of URLs like so:

<link rel="stylesheet" type="text/css" href="/home/user/public_html/js/calendar/calendar-win2k-1.css" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/reset.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/boxes.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/custom.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/xmlconnect/boxes.css" media="all" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/print.css" media="print" />
<link rel="stylesheet" type="text/css" href="/home/user/public_html/skin/adminhtml/default/default/menu.css" media="screen, projection" />

I immediately removed the extension and tried to match the perms from another server with a working Magento to no avail. I have also:

  • Cleared local, APC, and Magento caches
  • Looked in error logs (logging is enabled)
  • double-checked proper values of web/unsecure/base_url and web/secure/base_url in the DB
  • Rebooted, 3 times ;)

Minify is not being used. Merge CSS files are enabled, however I cannot figure out how to disable without the admin interface (save and navigation isn't working, even when I replace the correct values with Firebug). Any ideas would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

音盲 2024-12-29 00:07:08

编辑:正如 @michael-hampton 所提到的,此解决方案会造成严重的安全漏洞,不应使用。请不要在生产中使用!

我遇到了同样的问题,并且碰巧文件权限设置不正确。
为了允许 Magento 生成资产文件,media 目录必须可由 apache 用户写入。

如果 apache 不拥有该目录,那么这样做

chmod -R o+w media

不一定会允许 apache 在 media 目录中写入。

您应该通过首先检查 apache 运行时的用户,然后相应地调整权限:

chown -R <apache_user> media
chmod -R o+w media

更多信息:Magento 文件系统权限

EDIT: As mentioned by @michael-hampton, this solution opens a serious security hole and shouldn't be used. Please don't use in production!

I ran into the same problem, and it happens that file permissions were not set properly.
In order to allow Magento to generate assets files, media directory must be writable by apache user.

So doing

chmod -R o+w media

will not necessarily allow apache to write in media directory, if apache don't own this directory.

You should check that apache actually own media directory, by checking first which user apache is running as, and then ajust permissions accordingly :

chown -R <apache_user> media
chmod -R o+w media

More information here: Magento Filesystem Permissions

嘿嘿嘿 2024-12-29 00:07:08

一种更简单的方法是直接转到 magento 数据库并手动更改表 core_config_data 。应该有一个名为 dev/js/merge_filesdev/css/merge_files 的条目。
这两个值应为 1。通过将这两个值设置为 0,您将解决此问题,并且您的 cssjs 文件应该可以再次加载。在 magento 1.5.x 中测试。

A much simpler approach is to just head over to magento database and alter the table core_config_data manually. There should be an entry named dev/js/merge_files and dev/css/merge_files.
These two should hold values of 1.By setting these two values to 0, you'll get this fixed and your css and js files should be loadable again. tested in magento 1.5.x.

离旧人 2024-12-29 00:07:08

我最终修复了这个问题,通过浏览到相关管理页面并在 java 控制台中输入 configForm.submit() 来保存设置来禁用 CSS 合并。

不知道为什么 CSS 合并突然开始使用文件系统路径,我没有更改与此相关的任何内容(我正在安装的模块用于发票)。我在 Magento 中遇到过很多这样的随机问题,它似乎需要不断的修改。我绝对不愿意推荐另一个客户再次使用 Magento。

I ended up fixing it by being able to disable CSS merge by browsing to the relevant admin page and entering configForm.submit() in my java console to save the settings.

Not sure why CSS merge started using the file system paths of all a sudden, I wasn't changing anything associated with that (the module I was installing was for invoices). I've had a lot of randoms problem like this with Magento, it seems to require constant tinkering. I definitely am hesitant to recommend another client go with Magento again.

姜生凉生 2024-12-29 00:07:08

如果您正在使用 Fooman Speedster,只需从 Magento Connect 包管理器中卸载它即可。
然后,重新安装它。

不要使用包管理器中的重新安装功能,因为它不起作用。

If you're using Fooman Speedster, just uninstall it from the Magento Connect Package Manager.
Then, reinstall it.

Don't use the reinstall feature in the package manager, because it will not work.

脸赞 2024-12-29 00:07:08

有时,您需要确保 Magento 根目录中有 media 文件夹。

Sometimes, you need to make sure that you have the media folder in your Magento root directory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文