$file = 'perl -X /home/crysc/ed.fanworks.net/mt/mt-search.cgi ' . $args .'\n';
print ($file . '<br />');
Is the '\n' supposed to be there?
I'm not able to duplicate that error - testcase is:
$argv = escapeshellarg('SearchCutoff=999999');
$file = '/home/username/domain/test/remote.pl ' . $argv;
echo "Passing through to $file...\n";
echo "Done passing through.\n"
The only think I can think of is that mt-search.cgi checks to see if it was executed as CGI or CLI, and determines it was run as CGI and sees no parameters from the query string and of course it is not able to read anything from POST data, and its not coded to read from command line if run as CGI.
See, passthru() is disabled if the PHP script is run by PHP-Apache. However, it is enabled if run by PHP-CGI. When run as PHP-CGI, Apache sets up the CGI environment variables. When your PHP script calls passthru(), the same environment variables are available to that child, the child will be able to 1) access query string 2) know that it or its caller is in CGI, and not just CLI. Now, you're submitting the form data to the PHP script as a POST form - well your Perl script won't be able to access that data because STDIN was already read by PHP. I'm thinking if you could change it from POST to GET, it will work. Or if you hacked mt-search.cgi to read from the command line arguments even if run in CGI enviroment.
Hope that helps.