note 16492 deleted from function.include by jimw

From: Date: Thu, 01 Nov 2001 22:54:20 +0000
Subject: note 16492 deleted from function.include by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20021@lists.php.net to get a copy of this message
Here is the best fix for relative includes on *nix that I've found. Don't do them! Instead, create your mysite.com/includes dir and put all your includes in it. Then make a root level dir, like /www, set permissions so that only the webserver can use it. Inside that make a symbolic link with a unique name like /www/mysite_includes that points to mysite.com/includes. Now you can access your includes by include_once('/www/mysite_includes/my_file_to_include.php'); which points to mysite.com/includes/my_file_to_include.php. notice that it's slash (/) www which is your root level directory. This is very useful for servers with many domains where each site includes a lot of files. The symbolic link lets you keep your includes close to the directories of the rest of your code, yet allows you to access them abosolutely at the root dir level. It's probally a good idea to write in the headers of the files that use this that it is using the smbolic link.

« previous php.notes (#20021) next »