由于使用文件系统路径,Magento admin css 丢失

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8550612/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 02:25:15  来源:igfitidea点击:

Magento admin css missing due to using file system path

cssmagento

提问by reflexiv

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

我无法使用 Magento Connect 安装模块,出现Connection Error try again later错误。按照模块开发人员的说明,我尝试使用以下命令修复文档根目录中的权限:

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:

它仍然不起作用,所以我最终手动安装了模块。然后我登录到管理后端,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" />

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

我立即删除了扩展程序,并尝试将来自另一台服务器的权限与正常工作的 Magento 进行匹配,但无济于事。我也有:

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

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!

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

采纳答案by reflexiv

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.

我最终通过浏览到相关的管理页面并输入configForm.submit()我的 java 控制台以保存设置来禁用 CSS 合并来修复它。

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.

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

回答by flochtililoch

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

编辑:正如@michael-hampton 所提到的,这个解决方案打开了一个严重的安全漏洞,不应该使用。请不要在生产中使用!

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, mediadirectory must be writable by apache user.

我遇到了同样的问题,碰巧文件权限设置不正确。为了让 Magento 生成资产文件,媒体目录必须是 apache 用户可写的。

So doing

这样做

chmod -R o+w media

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

如果 apache 不拥有此目录,则不一定允许 apache 在 media 目录中写入。

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

您应该检查 apache 是否实际拥有媒体目录,首先检查apache 正在以哪个用户身份运行,然后相应地调整权限:

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

More information here: Magento Filesystem Permissions

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

回答by BennyZen

A much simpler approach is to just head over to magento database and alter the table core_config_datamanually. There should be an entry named dev/js/merge_filesand 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 cssand jsfiles should be loadable again. tested in magento 1.5.x.

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

回答by anon

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

如果您使用的是 Fooman Speedster,只需从 Magento Connect Package Manager 中卸载它。
然后,重新安装它。

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

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

回答by Ner

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

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