LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > [Solved] Unable to access files outside of VH_ROOT

Reply
 
Thread Tools Display Modes
  #1  
Old 05-30-2011, 03:15 PM
LunarCraft LunarCraft is offline
New Member
 
Join Date: May 2011
Posts: 8
Default [Solved] Unable to access files outside of VH_ROOT

Hi, I am fairly new to LiteSpeed and after setting up my virtual host everything seems to be working fine except from one thing. I am unable to access any of my files outside of the specified VH_ROOT.

I have ensured that the option "Restrain" is not enabled.

What I want to do is to be able to include a file that another program uses, for instance
/home/username/logs/ops.txt

Any heads up on what to look for would be much appreciated!

Error that occurs is just "An unexpected error occurred. Please try again later.", which leaves me much confusion.

Edit: also should mention that I made sure everyone has read permissions for the file, so that is not the issue afaik.

Last edited by LunarCraft; 05-30-2011 at 03:19 PM..
Reply With Quote
  #2  
Old 05-30-2011, 04:16 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,339
add the path to open_basedir
Reply With Quote
  #3  
Old 05-30-2011, 04:40 PM
LunarCraft LunarCraft is offline
New Member
 
Join Date: May 2011
Posts: 8
I am not sure if you read my question right. Cause after reading what it does, it seems to do the complete opposite of what I want to do.
"open_basedir, if set, limits all file operations to the defined directory and below.", what I want to do is the opposite.
I want to be able to include a file outside of my www folder, adding open_basedir broke the entire website as none of the actual website files are in that folder. Apache allows this by default, is there no other way to get it to work the same way?
Reply With Quote
  #4  
Old 05-30-2011, 05:16 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,339
If open_basedir is not empty, then you can add additional path to that (hence the suggestion) so that files from other places can be included. You can verify your open_basedir setting via a phpinfo page. if open_basedir is already empty (not set), then no need to worry about this.

please also check error.log or stderr.log for any indication. btw, what server environment and lsws version are you running?
Reply With Quote
  #5  
Old 05-30-2011, 05:43 PM
LunarCraft LunarCraft is offline
New Member
 
Join Date: May 2011
Posts: 8
phpinfo reports
Quote:
open_basedir no value no value
I am running LiteSpeed 4.1.1 Standard in an CentOS 5.6 X86_64 environment.

I went through the logs, but I cannot find anything besides the error that occurs when I try to open the file in php, and it seems to infinite loop itself too. I have about 50 files of 50MB each saying that it cannot open the file because a boolean was given instead, this is not an issue when I move the file to the VH_ROOT folder, it works like expected then.

Sadly that won't work for me.
Reply With Quote
  #6  
Old 05-30-2011, 07:58 PM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,339
can you post a code snippet in question? also see if the following works for you.

Code:
<HTML>
<BODY>
<?php
$file_handle = fopen("/etc/passwd", "r");

while (!feof($file_handle)) {

$line_of_text = fgets($file_handle);
print $line_of_text . "<BR>";

}

fclose($file_handle);
?>
</BODY>
</HTML>
Reply With Quote
  #7  
Old 05-30-2011, 08:48 PM
LunarCraft LunarCraft is offline
New Member
 
Join Date: May 2011
Posts: 8
For some reason that works for me.
$consoleOptions['pathOP'] equals /home/username/server/ops.txt (username is clearly not the real one). This worked fine prior to switching to litespeed.
PHP Code:
<?php if ( !defined('directblock') )
{
    die(
'Are you trying to hack me?');

$urls $consoleOptions['pathOP'];
$page join("",file("$urls"));
$kw explode("\n"$page);
$allowedOPS = array();
for(
$i=0;$i<count($kw);$i++){
$allowedOPS['name'] = $kw;
}
?>
edit: I noticed this also happens to my XML feed.
The following also returns an "An unexpected error occurred. Please try again later."

PHP Code:
$url 'http://anexternalserver/afolder/update/feed.xml';
$xml simplexml_load_file($url);
$lp_version $xml->checks[0]->buildnumber;
if (
$lp_version $lunarbuild) {
    echo 
nl2br('<b><span style="color: red;">There is a newer version available: '.'<i>'.$xml->checks->buildnumber.'</span></i></b>');
    
// Some information about the new build...
    
echo nl2br('<pre>Main change: '.$xml->checks->buildnotes."\nSize: ".$xml->checks->buildsize."\nLink: <a href=".$xml->checks->buildurl.'>'.$xml->checks->buildurl.'</a></pre>');
}else{ echo 
nl2br("<span style='color: green;'><b>Currently up to date.</b></span>\n"); } 
Edit2: I made my virtual host not use my server's log, nothing in it at all regarding the issues. error.log is empty and only the access.log gets filled up, stderr.log is also empty..

Edit3: After more troubleshooting I seem to have fixed the include error. Now I face the other question as previously mentioned. My XML feed gets the same "unexpected error" message, code was working fine in Apache and the XML is hosted externally.

Last edited by LunarCraft; 05-31-2011 at 10:45 AM..
Reply With Quote
  #8  
Old 06-02-2011, 01:49 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,339
pls paste some content of feed.xml here or pm the actual URL.
Reply With Quote
  #9  
Old 06-02-2011, 05:10 AM
LunarCraft LunarCraft is offline
New Member
 
Join Date: May 2011
Posts: 8
So far the XML looks like this.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<update>
	<checks>
		<buildnumber>0.2c</buildnumber>
        <buildurl>http://lunarcraft.org/?p=buildlink</buildurl>
        <buildnotes>Spacer</buildnotes>
        <buildsize>Spacer</buildsize>
	</checks>
</update>
Reply With Quote
  #10  
Old 06-02-2011, 10:29 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,339
check "allow_url_fopen" in phpinfo and make sure it is On.
Reply With Quote
Reply

Tags
access denied, restrain

Thread Tools
Display Modes

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

Forum Jump


All times are GMT -7. The time now is 09:03 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.