简体   繁体   中英

How to use PHPMailer via Composer on FTP

i have started making my own site where i want to use PHPMailer !.First of all i installed PHPMailer via Composer(cmd) on my desktop then used localhost to run my page where the PHPMailer was running just fine.I then tried to just transfer my page files and files that were generated in there from PHPMailer (those are: vendor directory , composer.json , composer.lock ) to FTP.When i tried running it on live page it didn't work and threw Error:

Fatal error: require(): Failed opening required '/www/sites/0/site25740/public_html/vendor/composer/ClassLoader.php' 
(include_path='.:/usr/share/php:/usr/local/zend/share/ZendFramework/library') in
 /www/sites/0/site25740/public_html/vendor/composer/autoload_real.php on line 12

I think that my problem is that i generated those files into my desktop directory and therefore they are not working on live page. Is there any way to maybe generate those files on my FTP server or maybe changing the structure of those files to work on live page?

You need to use SSH not FTP.

Once you SSH into your server, you can run the composer install command to install dependencies the same as you have on your desktop.

[Edit] An FYI - Yes, we can upload the vendor folder. Composer is a deployment tool. Uploading a vendor folder is NOT using a deployment tool.

If I am deploying 100 applications - and uploading 50mb of dependencies 100 times from a branch office on a cable/dsl ... how fast & efficient is that? If we offload that 50mb download to the server, how fast is that?

We have an option to do deployments wrong, or to do deployments properly.

I do not condone doing it wrong. It's clearly an option, however it is wrong.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM