20
votes

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!

5

5 Answers

43
votes

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

16
votes

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.

3
votes

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.

1
votes

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.

0
votes

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