Yes…you CAN run a php script inside a bash script. (or any other programming language actually, inside a bash script). The syntax is shown below. Now I’m not sure that it’s always wise to do that, but it’s interesting that you can do that 🙂
I actually needed the output of a php script inside the bash script and didn’t want to have to rewrite the entire php script in bash, and didn’t want to rewrite the shell script in php, so I just decided to include the php script inside the bash script to make it quicker to complete. Worked like a charm. Thought I’d share the way I did that.
# Run php scripts inside bash
/usr/bin/php -q <<'EOF'
#call function here