No Such File or Directory: Exec of FILE Failed

I recently ran into the error “No Such File or Directory: Exec of FILE Failed” when trying to update a Perl script on a server running Apache.
The actual error message looked more like this.

No such file or directory: exec of 'script.cgi' failed
Premature end of script headers: script.cgi

A long story short, it turns out that the issue was line endings. Windows uses a standard CR+LF (Carriage Return + Line Feed) while Unix uses LF (Line Feed). We spotted this, after a lot of trying to figure what was going on, by running a “cat script.cgi” command on the server. When the content was displayed, every line was ended with a “^W”.
When using an application like WinSCP to copy the files to the server, the line endings are often converted during the copy process. But if you use an automated release process, or other process that doesn’t have the same features, you must manually convert the files to using Unix style line endings.
I converted the files using Notepad++. There are End-of-Line (EOL) conversion utilities built in. They can be accessed by going to Edit -> EOL Conversion after you have opened the offending file.
For some more information on how to convert the line endings in Unix, check out
Once the line endings where converted from Windows to Unix style, everything worked as expected!
For some more information on line endings, check out Wikipedia,