denoteone Posted March 19, 2009 Share Posted March 19, 2009 my php page should return the data for and IP address after I shell_exec(); a variable containing the command to be sent to the system. what is getting returned is sh: line 1: whois: command not found could this have something to do with access issues on my godaddy hosting account? below is the function that is supposed to echo the data. $whois_ip_server = 'whois.arin.net'; $arin_ip = whois_ip($whois_ip_server, '-1', 'TRUE'); function whois_ip($whois_ip_server, $whois_ip_port, $do_echo) { if (eregi("^[a-z0-9\:\.\-]+$", $whois_ip_server)) { $host_ip = '62.219.133.209'; // The whois server "whois.arin.net" requires a "+" flag to get all the details if ($whois_ip_server == 'whois.arin.net') { $whois_ip_server .= ' +'; } // Set a variable containing the command to be sent to the system $command = "whois -h $whois_ip_server $host_ip"; // If we passed a specific port to this function to connect to, add the necessary info to the command if ($whois_ip_port > 0) { $command .= " -p $whois_ip_port"; } // Send the whois command to the system // Normally, the shell_exec function does not report STDERR messages. The "2>&1" option tells the system // to pipe STDERR to STDOUT so if there is an error, we can see it. $fp = shell_exec("$command 2>&1"); // If the $do_echo variable is set to "TRUE", send the results to the parse_output() function... if ($do_echo == 'TRUE') { $output = '<b>Whois (IP) Results:</b><blockquote>'; $output .= nl2br(htmlentities(trim($fp))); $output .= '</blockquote>'; echo $output; } // ...otherwise, return the results in a variable (i.e. for the ip_to_country() function) else { return $fp; } } else { echo '<b>Whois (IP) Results:</b><blockquote>'; echo 'Invalid character(s) in the Whois (IP) Server field.'; echo '</blockquote>'; } } Quote Link to comment https://forums.phpfreaks.com/topic/150090-shell_exec-issues/ Share on other sites More sharing options...
sKunKbad Posted March 19, 2009 Share Posted March 19, 2009 More than likely, Godaddy has probably added something like this in your php.ini: disable_functions = "exec,system,passthru,readfile,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,dl,popen,show_source" If you can alter this, then you might be able to do what you want to do. Quote Link to comment https://forums.phpfreaks.com/topic/150090-shell_exec-issues/#findComment-788238 Share on other sites More sharing options...
DyslexicDog Posted March 19, 2009 Share Posted March 19, 2009 looks like you're whois command isn't found in the default path. Try to determine where the whois command resides on the server, and be sure to include the full path to the whois executable. Quote Link to comment https://forums.phpfreaks.com/topic/150090-shell_exec-issues/#findComment-788239 Share on other sites More sharing options...
denoteone Posted March 19, 2009 Author Share Posted March 19, 2009 Ran On my test server at work and it seems to be working fine. Quote Link to comment https://forums.phpfreaks.com/topic/150090-shell_exec-issues/#findComment-788427 Share on other sites More sharing options...
trq Posted March 19, 2009 Share Posted March 19, 2009 Ran On my test server at work and it seems to be working fine. Does that mean your problem is solved then? Quote Link to comment https://forums.phpfreaks.com/topic/150090-shell_exec-issues/#findComment-788430 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.