My favorites | Sign in
Project Home Downloads Wiki Issues Source
Debugging problems
Phase-Implementation, Featured
Updated Mar 8, 2012 by

Server Errors

Code Most likely cause
400 Controller failed to return valid set of sources to serve
500 Minifier threw exception (e.g. JSMin choked on syntax)

You can find details by enabling FirePHP logging:

  1. Install/enable FirePHP.
  2. Open Firebug's console
  3. Set $min_errorLogger = true; in min/config.php
  4. Reload the Minify URL

Hopefully you'll see the error appear:

Minify: Something bad happened!

Javascript/CSS Problems

When Javascript errors occur, or URIs in CSS files are incorrectly rewritten, enable "debug mode" to ease debugging combined files:

  1. Set $min_allowDebugFlag = 'true' in min/config.php
  2. Append &debug to the Minify URI. E.g. /min/?f=script1.js,script2.js&debug (or use the bookmarklet provided by /min/builder/)

In "debug mode":

  • comments are inserted into the output showing you line numbers in the original file(s)
  • no minification is performed
  • In CSS, URI rewriting is performed
  • In CSS, a leading comment shows how URIs were rewritten.

Example: a combination of two Javascript files in debug mode

/* firstFile.js */

/* 1  */ (function () {
/* 2  */ 	if ( {
/* 11 */ })();

/* secondFile.js */

/* 1   */ var Foo = window.Foo || {};
/* 2   */

Example: Top of CSS output in debug mode

docRoot    : M:\home\foo\www
currentDir : M:\home\foo\www\css

file-relative URI  : typography.css
path prepended     : M:\home\foo\www\css\typography.css
docroot stripped   : \css\typography.css
traversals removed : /css/typography.css

file-relative URI  : ../images/bg.jpg
path prepended     : M:\home\foo\www\css\..\images\bg.jpg
docroot stripped   : \css\..\images\bg.jpg
traversals removed : /images/bg.jpg

Tips for handling Javascript errors

  • Use the latest version (2.1.4 beta as of Dec 2010)
  • Try debug mode to make the combined file more readable (and error locations findable)
  • Find out if other browsers have the same error
  • For pre-minified files, make the filenames end in .min.js or -min.js, which will prevent Minify from altering them
  • Test your scripts in JSLint.

See Also

Comment by, May 8, 2012

I am getting 400 Bad Request. I am testing locally using XAMP. My minify version is 2.1.5 .

Its really very frustrating

Comment by, May 19, 2012

I am also getting a 400 Bad Request. I am using my hosting account

Comment by, Jun 2, 2012

I am also getting a 400 Bad Request. I am using my hosting account

Comment by, Jul 23, 2012

I am also getting a 400 Bad Request. I am using my hosting account

Comment by, Sep 27, 2012

Actually, I don't really understand the call the the realpath() function in MinApp.php. After removing all of them, I have no more 400 Bad Request. You are not supposed to use realpath() if you use the DOCUMENT_ROOT env variable.

Comment by, Jan 16, 2013

I am getting same 400 bad request error. Removing realpath functions did not work for me.

Comment by, Mar 7, 2013

Works perfectly in my testing environment, but on my staging server, I get a 500 error only when I load the CSS group ( /min/?g=css ) Does anyone have any ideas?? I tried removing the css files from the group, and I get the same error. This feels like a dead-end.

Comment by, Apr 10, 2013

Same problem as above, works locally but on server it fails.

Comment by, May 31, 2013

Same probleme as above for me too. The Css works more or less, but the js not at all

Comment by, Aug 9, 2013

If you're getting this 500 error, check your logs! It's probably due to a wrong path or something like that! I'd been getting the same issue on my server but then i figured out Apache was actually logging that i was pointing to a wrong file, so php wasn't able to load that file and consequently throwing that error...

Comment by, Nov 4, 2013

set $min_documentRoot in your config.php file

Comment by, Nov 6, 2013

If you get "400 Bad Request" when using group (e.g. "/min/?g=files" check that you have correct paths in groupsConfig.php. Usual error is that you've defined absolute paths instead of web-absolute ones: 'files' => array('/file1.js', '/file2.js'); // probably wrong - looks for files in HDD root (equal to "c:\file1.js") 'files' => array('//file1.js', '//file2.js'); // correct - looks for files in web document root

Comment by, Nov 23, 2013

I am getting 400 Bad Request. I am testing locally using WAMP. My minify version is 2.1.5. The config-test.php file does not have any code.

Powered by Google Project Hosting