LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-23-2004, 02:16 PM   #1
tawalker
Member
 
Registered: Jan 2004
Location: UK
Distribution: Red Hat 9
Posts: 52

Rep: Reputation: 15
PHP include() file paths in Apache virtual hosts


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:

Code:
include (/includes/menu.php);
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:

Code:
include (./includes/menu.php);
(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?

Many thanks,
Tim
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vsftpd, web uploads, vsftpd virtual users, apache virtual hosts, home directories jerryasher Linux - Software 7 02-18-2007 06:29 AM
apache virtual hosts smaida Linux - Software 3 06-20-2004 04:28 PM
apache virtual hosts Red Squirrel Linux - Software 4 06-20-2004 09:05 AM
Apache 2 Suexec PHP and Virtual Hosts codedv Linux - Software 2 02-26-2004 04:56 PM
Apache Virtual Hosts (again) scatcat Linux - General 1 10-17-2002 09:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration