Reputation: 35
I would like to run some php code in my linux scripts to do some automation.I have searched on Google but I can't find any resources on it.Can anyone suggest a way to do this?
#!/bin/bash
<?php echo "this is a test "?>
Error Message:syntax error near unexpected token 'newline'
Upvotes: 0
Views: 141
Reputation: 78922
#!/usr/bin/php
<?php
echo 'foo';
use which php
to find out where your php interpreter is hidden and make sure you can execute your file chmod u+x foo.php
Upvotes: 0
Reputation: 540
You can run your script using command in bash on linux:
php /path/to/file.php
also you can put it into some bash script.
Upvotes: 1