I have a working Apache/PHP/MySQL setup on our home network server (Fedora Core 2), and have just set up a virtual host for developing a new Web site.
On previous PHP sites I've built, I have used PHP's include() function for page elements which are re-used (e.g. menus, meta tags and so on), and I intend to do the same with this site. However, I've come across a problem with the file path I use in the include statements.
Before now, a typical include would look something like this:
Note the file path here - it says "go back to the site root
, go into the includes directory and use the 'menu' code snippet". I specifically
want this, so that I can have a page template where I never have to change the file path in the include statements.
This is currently working fine on our existing Web site (on an external server), but when I try this on my home server, the include operation doesn't work at all.
If I try this:
(i.e. with a relative file path) it works, but this means I would have to change the file path if I create a page off the main site root (e.g. '/subfolder/page.php').
I think this is something to do with the server setup - maybe php.ini. Can anyone please advise me?