The ‘exec format error’ is the result of an invalid interpreter line. All scripts must begin with an interpreter line, also known as a shebang. This is the first line in the file and must start in the first column.
It begins with the two characters #! and then has the path to the interpreter, followed by any options we need to put in.
If you have this error, you may be missing your interpreter line, or it may be indented with a tab.
For example, if you needed to run a PHP script, it should start with:
#! /usr/bin/php
Or if you needed to run a Perl script with warnings enabled:
#! /usr/bin/perl -w
Where -w is the flag to enable warnings.