LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-20-2010, 04:41 AM   #1
Patric.F
Member
 
Registered: Feb 2010
Posts: 47

Rep: Reputation: 0
Apache settings for vhosts


Hi,

I have a friend that has a problem with his site on my server.
He doesn't have any problem on other servers so I guess there's something wrong in the config that I can change.

The site is in /html_doc and then he has a couple of other forlders for example, /api
In /api he tries to specify a file that's in the root of /html_doc like this:

Code:
require_once('inc/lang/'.$language.'/config.php');
I receive an error that the file can not be found but this fixes the problem:

Code:
require_once('../html_doc/inc/lang/'.$language.'/config.php');

Apparently it works on other servers so I'm wondering if I'm suppose to add something in his vhost that will fix this?

I think it can be fixed with settings in:

Code:
<Directory /var/www/domain
</Directory>
Right now I don't have one like that for him so I guess it uses the standard for /var/www/ which is:

Code:
<Directory /var/www/>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
If you see an obvious security-flaw or something you are more than welcome to criticize my configurtation, it's old and it just works so..

Thanks,

EDIT:

This is his vhost:

Code:
<VirtualHost *:80>
DocumentRoot /var/www/domain/html_doc
ServerName www.domain.com
ServerAlias domain.com
TransferLog /var/log/apache2/domain.log
</VirtualHost>

Last edited by Patric.F; 12-20-2010 at 04:42 AM.
 
Old 12-20-2010, 04:51 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
inc/lang should be /inc/lang

as it is it will try to find inc/lang inside api.
His problem not yours or apache's.
 
Old 12-20-2010, 06:24 AM   #3
Patric.F
Member
 
Registered: Feb 2010
Posts: 47

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smoker View Post
inc/lang should be /inc/lang

as it is it will try to find inc/lang inside api.
His problem not yours or apache's.
Thanks for the quick reply, I will talk to him about it.
But one thing that is weird.

Code:
require_once('admin_mod.php');
doesn't work but this does:

Code:
require_once('./admin_mod.php');
to me that is pretty much the same thing!? So is there something that I have misconfigured?
 
Old 12-20-2010, 10:01 AM   #4
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
it looks to me like the php script needs absolute or relative urls to work. I can't think of anything you could have misconfigured to make someone's script do that. Is there a base path or base url that's not set right in the php script ?
 
Old 12-21-2010, 02:42 AM   #5
Patric.F
Member
 
Registered: Feb 2010
Posts: 47

Original Poster
Rep: Reputation: 0
These are the only things I can find about any paths. Of course the site is pretty complicated so there's a lot of code involved.
To me that doesn't look wrong, but hey I'm no programmer.

Code:
define('webLocation','/');

define('workDir','/var/www/domain/html_doc/');

define('APPLICATION_PATH','/var/www/domain/html_doc/');


This is the error I get about it can't find admin_mod.php, in this script it isn't located in the same directory but it does chdir('../'); right before

Code:
Warning: require_once(admin_mod.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/domain/html_doc/admin/news/add.php on line 3

Fatal error: require_once() [function.require]: Failed opening required 'admin_mod.php' (include_path='/usr/share/php') in /var/www/domain/html_doc/admin/news/add.php on line 3
and after I add ./ in front of the admin_mod.php it start to work.. I have NO idea what could be wrong here and it's driving me nuts..
Any ideas of thing I can try? Maybe add something so it logs more specifically or something!?


EDIT:

I'm running Debian Lenny by the way.

Last edited by Patric.F; 12-21-2010 at 03:06 AM.
 
Old 12-21-2010, 02:58 AM   #6
Patric.F
Member
 
Registered: Feb 2010
Posts: 47

Original Poster
Rep: Reputation: 0
He keeps telling me that he doesn't have the right permissions. How can he not have the right permissions?
Can I set permissions in PHP for users? If so, how do I change it?


Thanks,
 
Old 12-21-2010, 04:24 AM   #7
Patric.F
Member
 
Registered: Feb 2010
Posts: 47

Original Poster
Rep: Reputation: 0
I made a test script on my own site like this:

/test/test.php:

Code:
<?php

chdir('../');

require_once('req.php');

echo "helo";

?>
/req.php:

Code:
<?php

echo "You're in root\n";

?>
And I get this:

Code:
Warning: require_once(req.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/mydomain/test/test.php on line 5

Fatal error: require_once() [function.require]: Failed opening required 'req.php' (include_path='/usr/share/php') in /var/www/fdab-joomla/test/test.php on line 5
The same error as on the other site so obviously this Should work right?

EDIT:

Ok so I tried on one of my friends servers and this script works fine there, so there is obviously a misconfig somewhere on the server.
I don't know if it's Apache or PHP?
 
Old 12-21-2010, 04:41 AM   #8
Patric.F
Member
 
Registered: Feb 2010
Posts: 47

Original Poster
Rep: Reputation: 0
I got so pissed that I took the standard apache2.conf and replaced it with mine just to see if it solved the problem, but it didn't.
So I took the standard php.ini -file and changed it with mine and now it works. Apparently there is some configuration in there that on of my friends made a while back when I installed the server, I have never personally edit that file my self.

Anyway, it works now! Thanks for your support.


-Patric
 
Old 12-21-2010, 04:53 AM   #9
Patric.F
Member
 
Registered: Feb 2010
Posts: 47

Original Poster
Rep: Reputation: 0
haha ok so I just found what messed it up.
By standard this is commented like this:
Code:
;include_path = ".:/usr/share/php"
When I checked my php.ini it looked like this:

Code:
include_path = "/usr/share/php"
Without the comment AND WITHOUT the ".:" in front of the path.. When I added ".:" it started working again so that's what messed it up
 
  


Reply



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
Setting up vhosts in apache 1.3.33 Erik Thorsson Debian 2 01-31-2005 09:46 PM
Help with Vhosts in apache please. GEEF Linux - Software 2 10-29-2004 07:18 PM
apache + dns + vhosts albertos Slackware 1 08-03-2003 07:03 PM
apache 2.0.44 vhosts sqn Slackware 4 06-19-2003 12:54 AM
Vhosts on RH 8.0 - Apache 2.0.40 Drogo Linux - Software 5 02-06-2003 11:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:59 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