Keep in mind also that Mac OS X bash does not handle carriage returns well, so if it seems like your code is not working when testing from the command line, redirect your output to a file and then try looking at that. On my system, doing it directly on the command line only showed the last line (with or without this setting turned on).

Also note that this will not do what you want if you have a file with mixed line endings (!). If you really care about that case, you have to do something else, like run the file through a translation first and then read it.

NOTE that setting 'auto_detect_line_endings' to true also affects exec() on Windows: the array &$output will technically still be filled with every line of output from the command, but instead contain all output as a single line in $output[0]!