Heroku调度程序执行一个PHP文件 [英] Heroku scheduler execute a PHP file
问题描述
默认的PHP buildpack在Heroku上目前没有 PHP CLI支持,所以你只能用它来通过Apache提供web请求而不是工人dynos中的脚本。但是,如果您正在使用具有CLI支持的PHP buildpack,则可以这样做。为了测试它,我派生了PHP构建包 / a>,转换出一个用CLI支持编译的PHP二进制文件,并将小型运行一个预定的PHP在Heroku上工作。请参阅项目的自述文件了解分步说明。要在现有的应用程序中使用此分支,请使用以下命令设置buildpack:
$ heroku config:add BUILDPACK_URL = https:// github .com / ryanbrainard / heroku-buildpack-php.git
请注意, release
脚本在我的叉子设置 PATH
来解析 / app / bin / php 中的
code>,只有
php
,不同于默认的需要使用绝对路径的buildpack
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 to run to heroku but not luck with running it with the scheduler.
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.
这篇关于Heroku调度程序执行一个PHP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!