<?php // Note: reuse is a symlink to /home/r/reuse require("reuse/Test.php"); ?>
The symlink /home/richard/public_html/reuse was made like this:
<?php $User="richard"; $R=symlink("/home/r/reuse","/home/$User/public_html/reuse"); ?>
I turned on PHP error reporting in .htaccess and got the following errors from tinytest.php:
Warning: require(reuse/Test.php): failed to open stream: No such file or directory in /home/richard/public_html/tinytest.php on line 3 Warning: require(reuse/Test.php): failed to open stream: No such file or directory in /home/richard/public_html/tinytest.php on line 3 Fatal error: require(): Failed opening required 'reuse/Test.php' (include_path='/home/r') in /home/richard/public_html/tinytest.php on line 3
I also tried testing in the browser address, using
https://example.com/reuse/Test.php and got this error:
Forbidden You don't have permission to access /reuse/Test.php on this server.
This is Test.php in reuse
I looked at the permissions on all relevant files and they were rw-r--r-- or better.
The owner of most files was "richard". The owner of / and /home were "root".
Motivation: /home/r/reuse is to be a directory of common PHP include files used by several of my websites. I put it in /home because that is the common root of all the virtual hosts on the Linux production server.