11

I am in the process of testing a Magento 1.3 site using Magento 1.4. I am seeing very weird and inconsistent behavior. Instead of including the URL of my javascript files, Magento is creating tags with the full filesystem path of the js files, as so:

<script type="text/javascript" src="/home/my_username/public_html/js/prototype/prototype.js"></script>

I believe this is related to the new "Themes JavaScript and CSS files combined to one file" function. In fact, when I log into the admin and click "Flush JavaScript/CSS Cache", then the first page load is successful, and I see a single JS include similar to:

<script type="text/javascript" src="/media/js/5b8cfac152fcb2a5f93ef9571d338c54.js"></script>

But subsequent age loads load every single JS file, with the full path names. Which obviously isn't going to work. Anyone have any ideas on what could be wrong or how to fix this issue?

Josh
  • 10,961
  • 11
  • 65
  • 108
  • @Mattias Bomelin -- I did not find an answer to this yet. When I do, I will post it as an answer here and accept it. Mark this question as a favorite by clicking the star under the downvote arrow if you want to keep track of it. – Josh Feb 05 '10 at 19:55

10 Answers10

11

It was permissions issue in my case. These ssh commands run in the root directory of Magento fixed it:

    # chown all to proper user and group, ie. www-data
    chown -R www-data:www-data *
    # change all files permissions to 644
    find . -type f -exec chmod 644 {} \;
    # change all directories permissions to 755
    find . -type d -exec chmod 755 {} \;
    # change all to be writable in var and media directories
    chmod -R 777 var/ media/

If it still doesn't work then change these two values for path column in the core_config_data in MySQL from "1" to "0":

  • dev/css/merge_css_files
  • dev/js/merge_files
marcinsdance
  • 634
  • 7
  • 17
9

go to System -> Configuration -> Developer Settings -> Javascript Settings -> Merge JavaScript Files (beta) and set it to "no". It is realy a beta :D

ThaKilla
  • 140
  • 2
  • 1
    this issue happens to me also on 1.7.0.1 ... disable 'dev/js/merge_files' was the only solution for me – WonderLand May 12 '14 at 13:32
  • 1
    If setting Merge Javascript and Merge CSS to "No" fixes your problem, the underlying issue is probably that your var/ directory is not writeable. Try checking permissions and ownership. – Eric Seastrand Feb 06 '15 at 20:31
  • Thanks :) Worked for me !!! My issue was i was not able to see images in Editor "Media storage" even create folder button was not working and browse files and upload file button was not visible. –  Mar 15 '16 at 10:30
9

Editing the config.xml didn't do the trick for me, I had to disable it in the database.

In table 'core_config_data' set the value of the row with path 'dev/js/merge_files' (config_id 772) to '0'.

Thanks for pointing me in the right direction though!

Ben
  • 91
  • 1
8

I had the same problem and came up with the following solution:

  1. Verify that the permissions on media/js belong to the same user that the magento installation's folder is.
  2. Clean the CSS/JS cache using the admin.

The combination of the two actually got things back to normal.

Avi Shefi
  • 156
  • 5
  • This is a simple permissions problem, albeit with a strange manifestation. Ensure that your `media` folder is writable by the web server user/group (however you want to do it) and everything'll work nicely. – Nick Feb 23 '11 at 15:20
  • In some cases (as in mine), you might not be able to even get into the admin. I followed the advice on Nick's site (http://www.nicksays.co.uk/2010/03/magento-including-javascript-by-system-path/). I had to run a query to change the setting temporarily, then log in and empty the cache, and then I changed the setting back (again using a query, since mysql was already open anyway). Query: UPDATE core_config_data SET `value` = 0 WHERE `path` = 'dev/js/merge_files'; I also wonder if deleting var/cache/* would work. – Buttle Butkus Jan 30 '12 at 11:23
4

Check if your media folder is writeable by the user you webserver runs with. I had a symlink to a folder that was only writeable by root

chown -R www-data:www-data media

helped.

Alex
  • 32,506
  • 16
  • 106
  • 171
1

Editing the config.xml didn't do the trick for me, I had to disable it in the database.

In table core_config_data set the value of the row with path dev/js/merge_files (config_id 772) to '0'.

Thanks for pointing me in the right direction though!

This solution is worked for me, thanks.

GDP
  • 8,109
  • 6
  • 45
  • 82
Rohit
  • 19
  • 1
1

I had the same Problem.

Its because magento can't find a javascript file. Look at your /var/log/exception.log (You have to enable the log in System -> Config -> Developer Options)

In my log was the following error:

exception 'Exception' with message 'Warning: filemtime() [function.filemtime]: stat failed for /var/www/js/calendar/lang/calendar-en.js in /var/www/app/code/core/Mage/Core/Helper/Data.php on line 631' in /var/www/app/code/core/Mage/Core/functions.php:245

So I created the file and voila it works !

ThaKilla
  • 140
  • 2
0

What are the values for the various Base URL fields under "Web" in the configuration? Should be something along the lines of

{{unsecure_base_url}}skin/

for the base skin URL.

Chris Norton
  • 807
  • 5
  • 4
  • Yeah, that's what it was. I even tried replacing {{unsecure_base_url}} with http://my.domain.name/ to no avail... – Josh Jan 27 '10 at 02:00
0

The problem is related with the javascript merge option. Unfortunatly the form does not work without javascript. You have to change the merge_files option in app/code/core/Mage/Core/etc/config.xml to 0.

        <js>
            <merge_files>0</merge_files>
            <deprecation>0</deprecation>
        </js>

After that I removed all cache files and session files in var directory.

giftnuss
  • 529
  • 2
  • 9
0

in magento 1.4 the config_id is 879 (for me) Setting this value to 0 gave me all my .js files back. Super weird

AKnox
  • 2,455
  • 3
  • 19
  • 19