On Tue, 14 Sep 2021 14:48:57 +0100, AllenJB <php.lists@xxxxxxxxxxxxx> wrote: >To account for symlinks (which allow you to pretend a file or directory >is in another place on the filesystem), run each path through realpath() >(I believe __DIR__ is already resolved for its "real path", but it >doesn't hurt to run it through again in this case to be sure) I used this php file put in a subdir below document root: <?php $rootdir= substr(__DIR__, 0, strpos( __DIR__, 'htdocs')) . 'htdocs'; echo "Root dir: " . $rootdir . "<br>"; echo "Real root path: " . realpath($rootdir) . "<br>"; $docroot=$_SERVER["DOCUMENT_ROOT"]; echo "Document root: " . $docroot . "<br>"; echo "Real document root: " . realpath($docroot) . "<br>"; include ($rootdir . '/php/logindata.php'); echo "Mail sender using Real root path: " . $mailsender ; ?> The printed output whan I call this php file with FireFox: Root dir: /data/25/2/158/91/2484743/user/2721122/htdocs Real root path: /data/25/2/158/91/2484743/user/2721122/htdocs Document root: /usr/services/vux/apache/htdocs Real document root: /usr/services/vux/apache/htdocs Mail sender using Real root path: donald@xxxxxxxx Notice that the two paths grabbed by __DIR__ and $_SERVER["DOCUMENT_ROOT"] are clearly different and using the latter in the include will make the $mailsender variable empty. -- Bo Berglund Developer in Sweden