|
|

05-30-2011, 03:15 PM
|
|
New Member
|
|
Join Date: May 2011
Posts: 8
|
|
[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..
|

05-30-2011, 04:16 PM
|
|
LiteSpeed Staff
|
|
Join Date: Oct 2010
Posts: 2,339
|
|
|
add the path to open_basedir
|

05-30-2011, 04:40 PM
|
|
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?
|

05-30-2011, 05:16 PM
|
|
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?
|

05-30-2011, 05:43 PM
|
|
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. 
|

05-30-2011, 07:58 PM
|
|
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>
|

05-30-2011, 08:48 PM
|
|
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..
|

06-02-2011, 01:49 AM
|
|
LiteSpeed Staff
|
|
Join Date: Oct 2010
Posts: 2,339
|
|
|
pls paste some content of feed.xml here or pm the actual URL.
|

06-02-2011, 05:10 AM
|
|
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>
|

06-02-2011, 10:29 AM
|
|
LiteSpeed Staff
|
|
Join Date: Oct 2010
Posts: 2,339
|
|
|
check "allow_url_fopen" in phpinfo and make sure it is On.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 09:03 AM.
|
|