0

i'm using phpmailer and my code work juts fine on the localhost

use PHPMailer\PHPMailer\PHPMailer;

use PHPMailer\PHPMailer\Exception;     

require 'PHPMailer\src\Exception.php';

require 'PHPMailer\src\PHPMailer.php';

require 'PHPMailer\src\SMTP.php';

but when i upload this to my host the error log says:

[08-Dec-2018 19:20:13 Europe/Madrid] PHP Warning: require(PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 6 [08-Dec-2018 19:20:13 Europe/Madrid] PHP Warning: require(PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 6 [08-Dec-2018 19:20:13 Europe/Madrid] PHP Fatal error: require(): Failed opening required 'PHPMailer\src\Exception.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ilefyaiq/public_html/formulario.php on line 6 [08-Dec-2018 19:35:18 Europe/Madrid] PHP Warning: require(PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 6 [08-Dec-2018 19:35:18 Europe/Madrid] PHP Warning: require(PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 6 [08-Dec-2018 19:35:18 Europe/Madrid] PHP Fatal error: require(): Failed opening required 'PHPMailer\src\Exception.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ilefyaiq/public_html/formulario.php on line 6 [08-Dec-2018 21:10:34 Europe/Madrid] PHP Warning: require(/home/ilefyaiq/public_htmlPHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:10:34 Europe/Madrid] PHP Fatal error: require(): Failed opening required '/home/ilefyaiq/public_htmlPHPMailer\src\Exception.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:13:30 Europe/Madrid] PHP Warning: require(\PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:13:30 Europe/Madrid] PHP Warning: require(\PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:13:30 Europe/Madrid] PHP Fatal error: require(): Failed opening required '\PHPMailer\src\Exception.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:14:29 Europe/Madrid] PHP Warning: require(\PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:14:29 Europe/Madrid] PHP Warning: require(\PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:14:29 Europe/Madrid] PHP Fatal error: require(): Failed opening required '\PHPMailer\src\Exception.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:17:37 Europe/Madrid] PHP Warning: require(/home/ilefyaiq/public_html\PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:17:37 Europe/Madrid] PHP Fatal error: require(): Failed opening required '/home/ilefyaiq/public_html\PHPMailer\src\Exception.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:19:58 Europe/Madrid] PHP Parse error: syntax error, unexpected '/', expecting identifier (T_STRING) or function (T_FUNCTION) or const (T_CONST) or \ (T_NS_SEPARATOR) in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:21:39 Europe/Madrid] PHP Warning: The use statement with non-compound name 'PHPMailer' has no effect in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:21:39 Europe/Madrid] PHP Parse error: syntax error, unexpected '/', expecting ',' or ';' in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:26:51 Europe/Madrid] PHP Warning: The use statement with non-compound name 'PHPMailer' has no effect in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:26:51 Europe/Madrid] PHP Parse error: syntax error, unexpected '/', expecting ',' or ';' in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:31:17 Europe/Madrid] PHP Warning: The use statement with non-compound name 'PHPMailer' has no effect in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:31:17 Europe/Madrid] PHP Parse error: syntax error, unexpected '/', expecting ',' or ';' in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:31:29 Europe/Madrid] PHP Warning: The use statement with non-compound name 'PHPMailer' has no effect in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:31:29 Europe/Madrid] PHP Parse error: syntax error, unexpected '/', expecting ',' or ';' in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:40:59 Europe/Madrid] PHP Warning: The use statement with non-compound name 'PHPMailer' has no effect in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:40:59 Europe/Madrid] PHP Parse error: syntax error, unexpected '/', expecting ',' or ';' in /home/ilefyaiq/public_html/formulario.php on line 5 [08-Dec-2018 21:41:47 Europe/Madrid] PHP Parse error: syntax error, unexpected 'header' (T_STRING) in /home/ilefyaiq/public_html/formulario.php on line 119 [08-Dec-2018 21:42:09 Europe/Madrid] PHP Parse error: syntax error, unexpected 'header' (T_STRING) in /home/ilefyaiq/public_html/formulario.php on line 119 [08-Dec-2018 21:42:47 Europe/Madrid] PHP Warning: require(PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:42:47 Europe/Madrid] PHP Warning: require(PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 11 [08-Dec-2018 21:42:47 Europe/Madrid] PHP Fatal error: require(): Failed opening required 'PHPMailer\src\Exception.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ilefyaiq/public_html/formulario.php on line 11

so i've tried changing the '\' to '/' but or putting __ dir __. before the paths but nothing is working. thanks in advice.

2
  • "Warning: require(PHPMailer\src\Exception.php): failed to open stream: No such file or directory in /home/ilefyaiq/public_html/formulario.php on line 6" -- it typically hints that the file does not exist. make sure the filenames are in proper case (e.g. PHPMailer and phpmailer are not the same thing). Commented Dec 8, 2018 at 22:03
  • This path is missing a slash: '/home/ilefyaiq/public_htmlPHPMailer\src\Exception.php'. That’s enough to kill it. Commented Dec 9, 2018 at 8:39

1 Answer 1

0

i don't know why but this work for me.

require_once(dirname(__DIR__).'/public_html/PHPMailer/src/SMTP.php');
require_once(dirname(__DIR__).'/public_html/PHPMailer/src/PHPMailer.php');
require_once(dirname(__DIR__).'/public_html/PHPMailer/src/Exception.php');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.