Passing value from HTML file to bash script
I am having the following requirement:
HTML file: Code:
<html> Code:
<?php Code:
#!/bin/bash the user must complete the starting date and ending date from the browser (html file), the dates are being pulled in the script.php which needs to run the bash.sh with the starting date and ending date as parameters. If I am doing this from the web browser interface, nothing happens and the bash does not run. But if I am running the bash.sh file on the server using: Code:
./bash.sh 01-Jan-2019 02-Jan-2019 What am I doing wrong? |
When the web server is running things, references are relative to the DocumentRoot...so the path to the script is probably something like /reports/bash.sh or maybe just /bash.sh...hard to say without knowing the DocumentRoot.
(And naming a script bash.sh is kinda confusing...just sayin’) |
1. DocumentRoot is /var/www/html/
I have put the all of the paths possible. Did not start the bash file. I have even left it in the root of the webserver. Just to test. 2. Well, it's just for testing purposes. The bash file which would be used has a totally different name. |
Quote:
BTW, looking at the web logs will probably show that the server can’t find the bash script...or maybe the php script. That’s the first place to look when troubleshooting a web server |
php has a date range function so there is no need for separate bash script. Assuming you are running apache by default it will not run scripts from document root although your calling it from php so that might not matter. Check the error logs.
|
Yep, main issue was with the path - for some reason the issue got fixed after I have moved the bash script to a different path and changed the path in script.php file to the full path to the bash script.
Thanks for the replies. :) We can close the topic. |
All times are GMT -5. The time now is 04:56 PM. |