Setting the PATH Variable
The command in your CGI script like:
system("ls -l /local/web/foo");
will look for program ‘ls’ from PATH.
Do set PATH at the beginning of your CGI script:
putenv("PATH=/bin:/usr/bin:/usr/local/bin");
In general it's not a good idea to put the current directory (".") into the path.
However, if possible, use this instead.
system("/bin/ls -l /local/web/foo");