Problemas con el uso de PHP Swift Mailer
-
28-10-2019 - |
Pregunta
Qué he hecho:
- ) Swift-4.1.5.tar descargado
- ) Lo extrajo
- ) Subido a mi host en / public_html / domain / lib usando FileZilla
- ) Creó una nueva secuencia de comandos utilizando el código siguiente.
- ) Lo abrí en el navegador y recibí el siguiente error a continuación
Entonces, mi pregunta es, ¿cómo obtengo el error de que el archivo no existe si está 100% allí?¡Gracias!
<?php
require_once '/public_html/domain/lib/swift_required.php';
?>
Advertencia: require_once (/public_html/domain/lib/swift_required.php) [function.require-once]: no se pudo abrir la transmisión: no existe ese archivo o directorio en /home/myuser/public_html/domain/email.php enlínea 5
Error fatal: require_once () [function.require]: Falló la apertura requerida '/public_html/domain/lib/swift_required.php' (include_path= '.: / usr / lib / php: / usr / local / lib /php ') en /home/myuser/public_html/domain/email.php en la línea 5
Aquí hay una captura de pantalla de mi directorio de FileZilla. http://i.imgur.com/Zsy8y.jpg
Solución
Esto está mal:
// this is absolute path, just like /home/user or /var/www
require_once '/public_html/domain/lib/swift_required.php';
Utilice en su lugar:
// this is relative path to the current file
require_once 'public_html/domain/lib/swift_required.php'; //notice: no '/' in the beggining
O:
// so use this one if you know the whole path to the file
require_once ABSOLUTE_PATH_TO . 'public_html/domain/lib/swift_required.php';
O:
// or use this one if you don't know the whole path
// or if the path will change (dev machine and production machine)
require_once dirname(__FILE__) . RELATIVE_PATH_TO . 'public_html/domain/lib/swift_required.php';