Apache version on server: 2.2.26
PHP version on server: 5.5.9
I have a file called admin_config.php
in a folder, which has an .htaccess
Paths you give to include
or require
are paths on the local filesystem. They are not what you see in URLs to access your site. An absolute path starting with /
is from the root of the filesystem. In Windows terms, /foo
is C:\foo\
. Relative paths like foo/bar
are relative to the the PATH
configuration variable, which depends on how your PATH
is set up which also includes which PHP file was invoked.
It's typically not a good idea to use absolute paths, since those are likely different on different systems (as you are experiencing). On your local machine the site may live in C:\core\...
, but on the server it'll be running in /var/www/mysite/core/...
. PATH
s can also be cumbersome to work with. The best is typically to use __DIR__
or __FILE__
magic constants to construct an absolute path relative to the current file (if that made sense):
require __DIR__ . '/some/folder/file.php`;
This includes the file some/folder/file.php
relative to the file in which it is written.