Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-21-2005, 08:34 PM
|
#1
|
LQ Newbie
Registered: Mar 2005
Posts: 6
Rep:
|
Question - (apache?)
Hello, i'm not sure if i'm asking this in the right place. I'm not a server-side person, but my server admin doesn't seem to be able to resolve my problem. Here it is:
I'm using linux Slackware10?, apache, php.
I have a user account set up: /home/name/web/
web is defined in apache as the public web folder.
(I don't know anything about what I just said, i'm basically repeating what the server guy told me.)
Now here's what I do know a lot about:
I have a completed website, that i'm porting over from another server. I use root-relative calls for the includes:
( /includes/include_name.html )
on the new system, root-relative calls to includes and ONLY includes don't work. I can call them with both absolute and relative paths no problem. But I need root relative to work, or I'll have to rebuild my whole site. I get the following error:
Warning: main(): Failed opening '/includes/include_name.html' for inclusion (include_path='.:/usr/local/lib/php') in /home/name/web/index.php on line 14
Can someone tell me if i need to change something in linux? apache? php? point me in the right direction? i'm at a loss...
Root relative calls to images and url's work fine. It's ONLY includes that don't work. And I've tried removing them from the "includes" directory, same thing.
The guy admin'ing the server has no idea why it doesn't work - If anyone can offer anything, please do - i'm at a loss.
thank you
|
|
|
03-21-2005, 09:26 PM
|
#2
|
Member
Registered: Oct 2004
Posts: 42
Rep:
|
Try manipulating permissions of files and directories includes files are in.
|
|
|
03-21-2005, 09:38 PM
|
#3
|
Member
Registered: Oct 2003
Distribution: Debian, RH, Knoppix, Ubuntu, CentOS
Posts: 62
Rep:
|
Assuming this is an apache server:
You should be able to use the relative url (as you are trying to do) but you need to know the correct Alias. The correct Alias is a string that is relative to the webroot. It is mapped to an absolute path (which may be something like "/usr/foo...") from within an apache config file. Apache config files vary from distro to distro. Most often, I think, there is only one. It is located either under /etc/apache or under /etc/apache2.
Of course, the following will let you know what the correct dir name is, underneath /etc:
"ls -1 /etc|grep apache"
When only one file is used, its probably named "/etc/apache/httpd.conf". If multiple files are used try
"/etc/apache2/sites-available/default".
Hope this helps.
|
|
|
03-22-2005, 07:34 AM
|
#4
|
LQ Newbie
Registered: Mar 2005
Posts: 6
Original Poster
Rep:
|
I know the proper path, it works fine with images, and urls. This is a very odd problem - the only thing "/" doesn't work with is includes. It's driving me nuts.
Last edited by pylon42; 03-22-2005 at 07:37 AM.
|
|
|
03-22-2005, 08:50 AM
|
#5
|
LQ Newbie
Registered: Mar 2005
Posts: 6
Original Poster
Rep:
|
I've got some new info:
I don't think this is a php thing - standard includes are doing the exact same thing.
I've been messing around with this and I got a / include to work by using the root of the actual server:
So this works:
<? include($DOCUMENT_ROOT."/home/username/web/include_name.html");?>
And this doesn't:
<? include($DOCUMENT_ROOT."/include_name.html");?>
Last edited by pylon42; 03-22-2005 at 09:34 AM.
|
|
|
03-22-2005, 01:20 PM
|
#6
|
LQ Newbie
Registered: Mar 2005
Posts: 6
Original Poster
Rep:
|
So to sum things up:
These work:
<img src="/image.gif"> (note that /root is working for this one)
<a href="/index.html"> (note that /root is working for this one)
<!-- #include virtual="include.html" -->
<? include("include.html"); ?>
These do not:
<!-- #include virtual="/include.html" -->
<? include($DOCUMENT_ROOT."/includes.html"); ?>
I need to get either of those two working somehow...
Any thoughts?
|
|
|
03-22-2005, 07:42 PM
|
#7
|
LQ Newbie
Registered: Mar 2005
Posts: 6
Original Poster
Rep:
|
More progress
This works:
<? include($DOCUMENT_ROOT."/home/username/web/include.html"); ?>
so. When using root relative calls to includes (and ONLY includes) it sees the root of the server, instead of the web root.
There must be something in some apache config file where I can fix this? Anyone? Please?
|
|
|
03-23-2005, 07:55 AM
|
#8
|
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552
Rep:
|
It appears that the value of $DOCUMENT_ROOT is null if it works when combined with a full path. Did you set $DOCUMENT_ROOT as $_SERVER['DOCUMENT_ROOT']? Also, the absolute paths that you are specifying for images (ie /image.gif) are using the Apache document root (/home/name/web). Your includes for files are using the file system root (/).
Last edited by stickman; 03-25-2005 at 08:15 AM.
|
|
|
All times are GMT -5. The time now is 11:15 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|