尝试使用&QUOT运行PHP文件; Heroku的运行"我也得到" bash的权限被拒绝"

问题描述:

我试图运行具有 Heroku的运行路径/要/ file.php A文件,我得到的回复:

I'm trying to run a file with heroku run path/to/file.php and I get a reponse:

庆典:路径/要/ file.php:权限被拒绝

我试过上的文件和目录行chmod 755,但似乎Heroku的改变回600 ...运行行chmod 755它显示了755后,但后来当我退出的bash,然后再回来的权限重置600。

I've tried chmod 755 on the file and directory, but it seems that heroku changes it back to 600... After running chmod 755 it shows 755, but then when I exit bash and then come back the permissions are reset to 600.

我在想什么?

也有人建议 Heroku的运行PHP路径/要/ file.php ,但我得到一个错误说庆典:PHP:找不到命令

Also some people have suggested heroku run php path/to/file.php but I get an error saying bash: php: command not found

有你需要做的几件事情。

There are a couple of things you need to do.


  • 当创建Heroku的应用程序,您必须确保该PHP buildpack使用。这是将注入PHP运行到应用程序中塞。无论是添加的index.php 文件(这是PHP如何检测)或硬code这样的: Heroku的配置:添加BUILDPACK_URL = HTTPS://github.com/heroku/heroku-buildpack-php.git

  • 详细介绍这个问题设置库路径:Heroku的配置:添加LD_LIBRARY_PATH = /应用程序/ PHP /分机:/应用/阿帕奇/ lib目录

  • 运行你的东西: Heroku的运行./php/bin/php --version

  • When creating the Heroku application, you have to make sure that the PHP buildpack is used. This is what will inject the PHP runtime into your application slug. Either add a index.php file (which is how PHP is detected) or hard-code it like this: heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php.git
  • Set the library path as detailed in this question: heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib
  • Run your stuff: heroku run ./php/bin/php --version

要总结一下:

heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php.git
heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib
heroku run ./php/bin/php --version

调试这个一个有用的方法是来砸到运行的Heroku的赛道:的Heroku运行的bash 。这将让你闲逛,看到那里的东西是在和实验。

A useful way to debug this is to bash into the running Heroku dyno: heroku run bash. That will let you poke around, see where things are at and experiment.