Heroku scheduler execute a PHP file

后端 未结 2 2182
小蘑菇
小蘑菇 2021-02-19 09:37

i\'m trying to run a php script using the heroku scheduler. What command should i put in after the $ in heroku. I keep getting file not found. I have transferred the file i want

2条回答
  •  说谎
    说谎 (楼主)
    2021-02-19 09:55

    The default PHP buildpack on Heroku does not currently have PHP CLI support, so you can only use it to serve web requests via Apache and not for scripts in worker dynos. However, this is possible if you are using a PHP buildpack that does have CLI support.

    To test it out, I forked the PHP buildpack, switched out the PHP binary with one that was compiled with CLI support, and put together small demo of running a scheduled PHP job on Heroku. See the project's readme for step-by-step instructions. To use this fork on an existing app, set the buildpack with:

    $ heroku config:add BUILDPACK_URL=https://github.com/ryanbrainard/heroku-buildpack-php.git
    

    Note, the release script in my fork sets up the PATH to resolve the php executable in /app/bin/php with just php, unlike the default buildpack that woud require using the absolute path.

提交回复
热议问题