CodeIgniter Forums
No such file, but it is clearly there - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: No such file, but it is clearly there (/showthread.php?tid=71661)



No such file, but it is clearly there - richb201 - 09-10-2018

I have this line near the top of on of my modules:

require_once ($_SERVER['DOCUMENT_ROOT'].'/application/third_party/phpmailer/src/PHPMailer.php');

but it causes this warning:

Message: require_once(/opt/bitnami/apache2/htdocs/application/third_party/phpmailer/src/PHPMailer.php): failed to open stream: No such file or directory

In the attached screen shot you can see the permissions for PHPMailer.php, I tried changing it to 777 with this:
 sudo chmod 777 /opt/bitnami/apache2/htdocs/sub_crud/application/third_party/phpmailer/src/PHPMailer.php

But my code (which worked fine in Windows) keeps failing on that require_once. Is their a limitation to how long a pathname can be in CI? What is wrong with it?  Huh



RE: No such file, but it is clearly there - ciadmin - 09-10-2018

Being picky, the PHPMailer.php is clearly somewhere, but you don't show the folder name.

The big clue that I see is that you require
"/opt/bitnami/apache2/htdocs/application/third_party/phpmailer/src/PHPMailer.php",
but you chmod'd
"/opt/bitnami/apache2/htdocs/sub_crud/application/third_party/phpmailer/src/PHPMailer.php".

Do you spot the difference between them? I even indented the above to make it easier to see :-O
Could your DOCUMENT_ROOT be set wrong?