Bash script to run php script

前端 未结 9 647
悲&欢浪女
悲&欢浪女 2020-12-07 20:30

I have a php script that I want to be run using a bash script, so I can use Cron to run the php script every minute or so.

As far as I\'m aware I need to create the

9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 21:04

    If you have PHP installed as a command line tool (try issuing php to the terminal and see if it works), your shebang (#!) line needs to look like this:

    #!/usr/bin/php
    

    Put that at the top of your script, make it executable (chmod +x myscript.php), and make a Cron job to execute that script (same way you'd execute a bash script).

    You can also use php myscript.php.

提交回复
热议问题