I have a large web application with may include and require calls that look like '/home/file/...'. However, I cannot house the include files on my system's /home directory, nor can i create a sym link /home because there is an already existing and used directory there.
How can I redirect '/home' includes to another directory or force php to look for 'home' inside any include directories specified in php.ini? I cannot change all instances of /home' referenced in the web application.
php require and include paths
Moderator: General Moderators
Re: php require and include paths
You have to change them. And never write paths in this way...
I always use:
In this way, I'm always referring to path, relatively to the file I'm in, and I'm not relying on the current working directory and the full path is not hard-coded 
I always use:
Code: Select all
require_once( dirname(__FILE__) . '/path/to/file.php'Re: php require and include paths
I know, I never code absolute paths, but inherited this app and must maintain it. Anyway, it turns out the /home sym link in my way was created by auto_mount (mac) and has no function. I commented out the line and restarted and now the sym link is gone and I can place files there.