2017-11-14 4 views
0

PHPMailer를 제대로 설정하여 서버에서 작동되게하려면 어떻게해야합니까?PHPMailer 6 작곡가가 작동하지 않습니다.

제공된 예제와 같이 설정했습니다.

하나의 파일을 업로드했습니다. 파일이 실행되었지만 모두 내가 얻은 것은 500 내부 서버 오류입니다.

=============== 편집 ===============

문제는 PHP 버전 5.3.3 될 것으로 보인다

이 설치는 PHP 버전^7

에서 작동합니다.

서버 설정

/ root 
- uploads.php 
- form.html 
- vendor (dir) 
    - composer (dir) 
    - phpmailer (dir) 
    - autoload.php 

.

form.html

<!DOCTYPE html> 
<html> 
    <head> 
    </head> 
    <body> 
    <form action="upload.php" method="POST" enctype="multipart/form-data"> 
     <input type="file" name="file"> 
     <button type="submit" name="submit">Upload</button> 
    </form> 
    </body> 
</html> 

.

upload.php로

<?php 
use PHPMailer\PHPMailer\PHPMailer; 
use PHPMailer\PHPMailer\Exception; 

require './vendor/autoload.php'; 

if ($_SERVER['REQUEST_METHOD'] === 'POST') { 

    $mail = new PHPMailer; // <-- error on this line 
    echo "after phpmailer"; // <-- does not run 

    // phpmailer code here ... 

} 

답변

1

PHPMailer 6.0 및 최대 최소한 PHP 5.5이 필요합니다. 어쨌든 최소한 PHP 7.0 이상을 사용해야합니다. 그러나 그 경우에도 2017 년 12 월에 만료됩니다.