如何将 ftp 扩展添加到 Heroku php 应用程序?
我正在使用 heroku 开发 Facebook 应用程序。我的应用程序需要能够将文件(图片)上传到远程服务器上的文件夹,我认为 ftp 是最佳选择。不幸的是,ftp 扩展并未立即启用。我与支持人员进行了交谈,他们提出了以下建议:
“不幸的是,我们目前不支持 FTP 或任何 PHP 扩展。
但好消息是,我们刚刚开源了 PHP 构建包,因此您可以尝试自己供应它: https://github.com/heroku/heroku-buildpack-php"
所以我是假设我可以按照上面链接中的自述文件说明进行操作,并且只需包含 --enable-ftp 选项?
这有点超出了我目前的知识范围,我真的很感谢您的帮助,并期待学习新的东西。
I am developing a Facebook app using heroku. My app needs the ability to upload files (pictures) to a folder on a remote server, and I assume ftp is the best option. Unfortunately the ftp extension is not enabled out of the box. I spoke with support and they suggested the following:
"We unfortunately don't support FTP, or any PHP extension at this moment.
But the good news is that we just open sourced our PHP build pack, so you could try to vendor it yourself:
https://github.com/heroku/heroku-buildpack-php"
So I am assuming I can follow the readme instructions in the link above, and simply include the --enable-ftp option?
This is a bit beyond my current knowledge. I really appreciate the help, and look forward to learning something new.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不得不做类似的事情。这就是我所做的:
1.您需要使用一个自定义构建包来安装 pear 软件包 Net_FTP。我建议你分叉我一直在使用的那个(https://github.com/antonyevans/heroku-buildpack-php/)
然后你需要更改 bin/compile。关键的更改是删除了行(大约 163):
并添加了 Net_FTP 扩展:
2.然后您需要告诉您的应用程序加载包:
I had to do something similar. Here's what I did:
1.You need to use a custom buildpack which installs the pear packages Net_FTP. I suggest that you fork the one I've been using (https://github.com/antonyevans/heroku-buildpack-php/)
Then you need to change bin/compile. Key changes are the removal of the lines (around 163):
And the addition of Net_FTP extension:
2.Then you need to tell your application to load the package:
您最大的问题是 Heroku 文件系统是短暂的。我建议您回去再次查看您的架构。
Your biggest problem is that the Heroku file system is emphemeral. I would suggest going back and looking at your architecture again.