Heroku调度程序执行一个PHP文件 [英] Heroku scheduler execute a PHP file

查看:139
本文介绍了Heroku调度程序执行一个PHP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行一个使用heroku调度程序的PHP脚本。在heroku之后,我应该输入什么命令。我不断收到文件没有找到。我已经把我想运行的文件转移到了heroku,但并没有运行与调度程序运行。

解决方案

默认的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆