Laravel Asset Compressor Bundle and filemtime() stat error

This appears to only be a problem with Windows. If you see an error like this while using the asset compressor:

filemtime() [function.filemtime]: stat failed for [some file path]
E:\www\yourapplication\laravel\file.php on line 136

know that the code probably works on Linux and OS X, but not on your own Windows machine.


OS X and Linux use / as a directory separator. Windows uses \. PHP is tolerant of this, but the Google Closure Compiler that does the heavy lifting for this bundle is not. It doesn’t work with Windows paths containing \, like the ones the Asset Compressor has generated for it to use. If you get the command that the asset compressor generates (look for exec("$java $jar $scripts_to_minify $out_script");), replace all the \ with /, and run that line through the command line, you may find it works!

The Quick Solution

Set the enabled property in the bundle’s config file to something like this to disable the compressor on Windows, and enable it on other operating systems with the right directory separator:

    'enabled' => DIRECTORY_SEPARATOR == '/',

If your live server uses Linux, the compiler will compress your assets the first time someone visits your site. This can add several additional seconds to any page load that triggers the compiler.

The Smarter Solution

Fork it, fix it, pull request it.

fix FB.getLoginStatus() called before calling FB.init()

To fix this error, I had to take a second look at my FB.init code.

I had just moved a site to a new server, and started seeing the error in Chrome’s dev console. The all.js file loaded successfully, so that wasn’t the problem. I blamed Facebook for a few minutes and then spotted the problem after looking at my page’s source:

  appId      : '', // App ID
  channelUrl : '[an ok value]', // Channel File
  status     : true, // check login status
  cookie     : true, // enable cookies to allow the server to access the session
  xfbml      : true  // parse XFBML

appId was blank because the server-side code that defines it could not pick an appId after the move. When appId was corrected, everything worked again. Beware of the blank appId. It happened to this guy too.

error while loading shared libraries

Just installed ffmpeg on Ubuntu 12 and tried running it only to see this error?

ffmpeg: error while loading shared libraries: cannot open shared object file: No such file or directory

ffmpeg is looking in the wrong spot for the library you installed. Try this bash command:

ldd `where ffmpeg`

And look for a line like this in the result to confirm the issue: => not found

How to fix it

Using this additional command fixed my problem.

sudo ldconfig -v

This updates the lists of shared libraries cached in Ubuntu, and now ffmpeg can find that missing shared library.