4

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.

4

2 回答 2

1

您最大的问题是 Heroku 文件系统是临时的。我建议回去再看看你的架构。

于 2012-02-07T11:10:02.327 回答
1

我不得不做类似的事情。这是我所做的:

1.您需要使用自定义 buildpack 来安装 pear 包 Net_FTP。我建议你分叉我一直在使用的那个(https://github.com/antonyevans/heroku-buildpack-php/)

然后你需要改变 bin/compile. 主要变化是删除了行(大约 163 行):

php/bin/pear install mail
php/bin/pear install Net_SMTP

并添加了 Net_FTP 扩展:

php/bin/pear install Net_FTP

2.然后你需要告诉你的应用程序加载包:

require_once 'Net_FTP.php';
于 2012-11-29T23:28:52.097 回答