How to add ftp extension to Heroku php app?

I am developing a Facebook application using a hero. My application needs the ability to upload files (images) to a folder on a remote server, and I believe ftp is the best option. Unfortunately, the ftp extension is not included out of the box. I spoke with support, and they suggested the following:

"Unfortunately, we do not currently support FTP or any PHP extension.

But the good news is that we just open our collection of PHP builds, so you can try it yourself: https://github.com/heroku/heroku-buildpack-php "

So, I assume that I can follow the readme instructions in the link above and just include the --enable-ftp option?

This is slightly higher than my current knowledge. I really appreciate the help and look forward to learning something new.

+4
source share
2 answers

I needed to do something like this. Here is what I did:

1. You need to use your own collector, which installs Net_FTP pear packages. I suggest you develop the one I used (https://github.com/antonyevans/heroku-buildpack-php/)

Then you need to change bin / compile. Key changes are the removal of lines (about 163):

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

And adding the Net_FTP extension:

 php/bin/pear install Net_FTP 

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

 require_once 'Net_FTP.php'; 
+1
source

The biggest problem is that the Heroku emphemeral file system. I would suggest going back and taking a look at your architecture again.

+1
source

Source: https://habr.com/ru/post/1395129/


All Articles