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'
答案 0 :(得分:1)
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.
答案 1 :(得分:0)
#!/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