Bash script to run php script

前端 未结 9 677
悲&欢浪女
悲&欢浪女 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:01

    I found php-cgi on my server. And its on environment path so I was able to run from anywhere. I executed succesfuly file.php in my bash script.

    #!/bin/bash
    php-cgi ../path/file.php
    

    And the script returned this after php script was executed:

    X-Powered-By: PHP/7.1.1 Content-type: text/html; charset=UTF-8

    done!

    By the way, check first if it works by checking the version issuing the command php-cgi -v

提交回复
热议问题