Hostname to Query is <?php echo $_GET["hostname"];
$hostname = $argv;
#echo "This is $hostname\n";
#$result = shell_exec('/var/www/html/scripts/REST-API/dpa_reports.sh ' . $hostname);
$result = shell_exec('/var/www/html/scripts/REST-API/dpa_reports.sh ' . $hostname);
---------- Post updated at 12:38 PM ---------- Previous update was at 12:33 PM ----------
if I do the following from the command line it passes the "hostname" variable to the bash script dpa_report.h script fine. But when I submit the "hostname" from my browser it does not pass the variable...
Assuming that you are using Apache as the web server, you can do the following:
Start an additional terminal window, and run "tail -f /var/log/apache2/error.log". You will get al running list of errors from your web development.
Thank jgt That fixed that particular problem. Now I am getting a curl error though. If I run the curl from the command line I have no issue but when it is called from the php script which calls the bash script I get this error
curl: (7) Failed to connect to 172.16.120.152: Permission denied
The curl command works fine when I do it from the command line.
Any idea why this is happening?
---------- Post updated at 03:36 PM ---------- Previous update was at 03:34 PM ----------
This is the curl command (I have taken out the username and password
This the bash script (dpa_report.sh) that creates the REST -API report. I have taken out the actual username and password for the purposes of this post. If I run this script from the command line and pass it the hostname it works. For example
works. The hostname is set to $1 in the script.
But when dpa_report.sh is called from the php script I get the permission errors.