LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Question - (apache?) (https://www.linuxquestions.org/questions/linux-general-1/question-apache-304498/)

pylon42 03-21-2005 08:34 PM

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

pave 03-21-2005 09:26 PM

Try manipulating permissions of files and directories includes files are in.

JohnBoy 03-21-2005 09:38 PM

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.

pylon42 03-22-2005 07:34 AM

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.

pylon42 03-22-2005 08:50 AM

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");?>

pylon42 03-22-2005 01:20 PM

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?

pylon42 03-22-2005 07:42 PM

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?

stickman 03-23-2005 07:55 AM

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 (/).


All times are GMT -5. The time now is 11:10 AM.