Passing variable from bash script to php script.
I am at my wits end on this one. What syntax error?
Quote:
Can someone tell me what I am doing wrong? Thanks for any light you can shed on this. Dave Code:
#!/bin/bash |
You are using the wrong shebang! (The first line of a file starting with #!. It tells the calling program which program it should use to interpret the script.
So you can either remove the shebang line and call the script with php -e /path/to/file or put the path to the php binary in place of /bin/bash in the first line. There also I a little trick and put #!$(which php) as first line. This calls which which returns the path to the binary past as the first argument to it. |
bash and php are different programs/languages! here is an example how to use $argv:
Code:
#!/usr/local/bin/php |
I got the syntax error gone. Thank you 'NevemTeve'.
Some printf statements show that the correct data is being passed. But it is not returning any results. Anyone got any ideas why Code:
$locationOfString = stripos($stringToSearch, $searchPattern) Is there a different PHP search I could use? Quote:
Code:
#!/usr/local/bin/php |
That's what debugging is good for:
Code:
$locationOfString = stripos($stringToSearch, $searchPattern); |
Want to thank you guys for the feed back. The problem I was having was my own goof up. My code was searching one part of the state for an event. My data base was for a different part of the state. Once that was fix, everything works as expected. Mark this solved.
Thanks again. |
All times are GMT -5. The time now is 12:47 AM. |