LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 03-21-2005, 09:34 PM   #1
pylon42
LQ Newbie
 
Registered: Mar 2005
Posts: 6

Rep: Reputation: 0
Question 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
 
Old 03-21-2005, 10:26 PM   #2
pave
Member
 
Registered: Oct 2004
Posts: 42

Rep: Reputation: 15
Try manipulating permissions of files and directories includes files are in.
 
Old 03-21-2005, 10:38 PM   #3
JohnBoy
Member
 
Registered: Oct 2003
Distribution: Debian, RH, Knoppix, Ubuntu, CentOS
Posts: 62

Rep: Reputation: 15
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.
 
Old 03-22-2005, 08:34 AM   #4
pylon42
LQ Newbie
 
Registered: Mar 2005
Posts: 6

Original Poster
Rep: Reputation: 0
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 08:37 AM.
 
Old 03-22-2005, 09:50 AM   #5
pylon42
LQ Newbie
 
Registered: Mar 2005
Posts: 6

Original Poster
Rep: Reputation: 0
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 10:34 AM.
 
Old 03-22-2005, 02:20 PM   #6
pylon42
LQ Newbie
 
Registered: Mar 2005
Posts: 6

Original Poster
Rep: Reputation: 0
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?
 
Old 03-22-2005, 08:42 PM   #7
pylon42
LQ Newbie
 
Registered: Mar 2005
Posts: 6

Original Poster
Rep: Reputation: 0
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?
 
Old 03-23-2005, 08:55 AM   #8
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
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 09:15 AM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Question rshooper Linux - Software 1 09-21-2004 10:29 PM
Apache question RandyAdams Linux - Software 1 04-07-2004 05:02 PM
apache question plisken Linux - Software 3 03-09-2004 11:26 AM
another apache question needforspeed Linux - Software 2 09-26-2003 10:24 PM
Apache 2.0 question deepsix Linux - Software 10 08-29-2003 08:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:42 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration