在 AWS elasticbeanstalk 上部署一段代碼,向用戶發(fā)送電子郵件驗證帳戶創(chuàng)建。我測試了電子郵件代碼,它可以在我的本地機器上運行。為了在服務器上測試它,我編寫了這個測試用例并且它有效。但是當它被應該使用它的模塊調(diào)用時,它就會中斷。我需要故障排除方面的幫助。由于同一個模塊被 2 個不同的模塊(test 和 prod)調(diào)用,并且它與 test 一起工作,我傾向于認為它與調(diào)用模塊有關,但除了 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條經(jīng)驗 獲得超3個贊
根據(jù) Synchro 的輸入,有效的解決方案是:
require_once( __DIR__.'/../PHPMailer/PHPMailer.php');
require_once( __DIR__.'/../PHPMailer/SMTP.php');
require_once( __DIR__.'/../PHPMailer/Exception.php');
- 1 回答
- 0 關注
- 124 瀏覽
添加回答
舉報
0/150
提交
取消