简体   繁体   English

如何通过FTP上的Composer使用PHPMailer

[英]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: 我已经开始在自己的站点上创建要使用PHPMailer的站点了。首先,我通过Composer(cmd)在桌面上安装了PHPMailer,然后使用localhost运行了运行PHPMailer的页面,然后尝试转移我的页面文件和从PHPMailer在那里生成的文件(这些文件是: vendor目录, composer.jsoncomposer.lock )到FTP。当我尝试在实时页面上运行它时,它不起作用并抛出错误:

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? 有什么方法可以在我的FTP服务器上生成这些文件,或者可以更改那些文件的结构以在实时页面上工作吗?

You need to use SSH not FTP. 您需要使用SSH而不是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. SSH进入服务器后,您可以运行composer install命令以安装与桌面上相同的依赖项。

[Edit] An FYI - Yes, we can upload the vendor folder. [编辑]仅供参考-是的,我们可以上传供应商文件夹。 Composer is a deployment tool. Composer是一种部署工具。 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? 如果我要部署100个应用程序-并通过电缆/ dsl从分支机构上载50mb的依赖项100次,那是多么快速和高效? If we offload that 50mb download to the server, how fast is that? 如果我们将50mb的下载量卸载到服务器,那么速度有多快?

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. 显然这是一个选择,但是这是错误的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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