为了账号安全,请及时绑定邮箱和手机立即绑定

AWS elasticbeanstalk 上 PHPMailer 实施的故障排除建议

AWS elasticbeanstalk 上 PHPMailer 实施的故障排除建议

PHP
慕标琳琳 2022-12-03 10:41:15
在 AWS elasticbeanstalk 上部署一段代码,向用户发送电子邮件验证帐户创建。我测试了电子邮件代码,它可以在我的本地机器上运行。为了在服务器上测试它,我编写了这个测试用例并且它有效。但是当它被应该使用它的模块调用时,它就会中断。我需要故障排除方面的帮助。由于同一个模块被 2 个不同的模块(test 和 prod)调用,并且它与 test 一起工作,我倾向于认为它与调用模块有关,但除了 include 语句的格式之外,我没有看到它会如何破裂。工作测试代码:试验结果:错误:[Wed Apr 01 16:45:53.262139 2020] [php7:notice] [pid 10670] [client 136.55.180.140:29275] Array\n(\n    [count] => 1\n)\n, referer: http://bluetooth-env-test.eba-brqgvwur.us-east-2.elasticbeanstalk.com/WebApp/new_user.php[Wed Apr 01 16:47:40.599465 2020] [php7:warn] [pid 10669] [client 136.55.180.140:29293] PHP Warning:  require_once(../PHPMailer/PHPMailer.php): failed to open stream: No such file or directory in /var/app/current/WebApp/utils/emailVerification.php on line 13, referer: http://bluetooth-env-test.eba-brqgvwur.us-east-2.elasticbeanstalk.com/WebApp/new_user.php[Wed Apr 01 16:47:40.599502 2020] [php7:error] [pid 10669] [client 136.55.180.140:29293] PHP Fatal error:  require_once(): Failed opening required '../PHPMailer/PHPMailer.php' (include_path='.:/usr/share/pear7:/usr/share/php') in /var/app/current/WebApp/utils/emailVerification.php on line 13, referer: http://bluetooth-env-test.eba-brqgvwur.us-east-2.elasticbeanstalk.com/WebApp/new_user.php共享模块的源代码:它在 require_once('../PHPMailer/PHPMailer.php'); 处中断<?php// session_start();    use PHPMailer\PHPMailer\PHPMailer;    use PHPMailer\PHPMailer\SMTP;    use PHPMailer\PHPMailer\Exception;function emailVerify($email, $hash){require_once('../PHPMailer/PHPMailer.php');require_once('../PHPMailer/SMTP.php');require_once('../PHPMailer/Exception.php');echo (extension_loaded('openssl')?'SSL loaded':'SSL not loaded')."\n";$mail = new PHPMailer(true);try{$mail->SMTPDebug = SMTP::DEBUG_SERVER;$mail->SMTPOptions = array(                  'ssl' => array(                      'verify_peer' => false,                      'verify_peer_name' => false,                      'allow_self_signed' => true                  )              );
查看完整描述

1 回答

?
泛舟湖上清波郎朗

TA贡献1818条经验 获得超3个赞

根据 Synchro 的输入,有效的解决方案是:


    require_once( __DIR__.'/../PHPMailer/PHPMailer.php');

    require_once( __DIR__.'/../PHPMailer/SMTP.php');

    require_once( __DIR__.'/../PHPMailer/Exception.php');


查看完整回答
反对 回复 2022-12-03
  • 1 回答
  • 0 关注
  • 126 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号