Domanda

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.

È stato utile?

Soluzione

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):

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

And the addition of Net_FTP extension:

php/bin/pear install Net_FTP

2.Then you need to tell your application to load the package:

require_once 'Net_FTP.php';

Altri suggerimenti

Your biggest problem is that the Heroku file system is emphemeral. I would suggest going back and looking at your architecture again.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top