douwen1901 2013-01-17 22:15
浏览 99
已采纳

尝试使用“heroku run”运行php文件,我得到“bash权限被拒绝”[关闭]

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

bash: path/to/file.php: Permission denied

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.

What am I missing?

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

  • 写回答

2条回答 默认 最新

  • dongpeng7744 2013-01-18 00:17
    关注

    There are a couple of things you need to do.

    • 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

    To sum up:

    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
    

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据