You are not logged in.
I have this page...
<html>
<head><title>Directory</title></head>
<body>
<?php
$path = "./";
if (strrpos($moverse,'..')) {
$moverse = str_replace('/..','',$moverse);
$moverse = substr($moverse,0,strrpos($moverse,'/'));
}
if($moverse) $moverse = $moverse."/";
echo "Root/".$moverse.'<br>'.'<br>';
$handle=opendir($path.$moverse);
while ($file = readdir($handle)) {
if(is_dir($path.$moverse.$file) && $file != "." && $file != "index.php") {
if ($file == ".." && $moverse == "") {
} else {
echo "[DIR] <a href='?moverse=".$moverse.$file."'>".$file."</a><br>";
}
} else if ($file != "." && $file != "index.php") {
echo "&emsp &emsp<a href='".$path.$moverse.$file."'>".$file."</a><br>";
}
}
?>
</body>
</html>
On my school's webserver (solaris/apache) it works fine, but on all of my arch computers, it only reads the root directory (of the script). Clicking on one of the links it generates just reloads the root directory. All other things php seem to be just fine, although I don't really do that much with it so I could be wrong; I use it mostly for include statements. But it seems to set up a phpinfo() test page just fine.
My steps setting up apache and php
pacman -S apache php
uncomment apache5_mod (or whatever that commented line in the modules section was)
create /home/httpd/html/index.php
throw in some test directories and files into html
/etc/rc.d/httpd start
If anyone recreates this problem or is aware of what step I'm missing, let me know.
=> Now known as jb
Offline
sounds like a read permission problem to me....
Offline
hmm...seems like the solaris install must have had apache running as root.
LOL.
yeah, it is probably a permission issue.
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
what?
In order to do this I have to be running apache as root?
I'm going to go check their config file on that.
...
Their user/group lines are
User www
Group www
So if I run apache and php as a user that isn't root or nobody, will it work?
=> Now known as jb
Offline
it was just a guess. If they had been running it as root (bad bad bad), then it would have been able to read anything..(bad bad bad).
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
what?
In order to do this I have to be running apache as root?I'm going to go check their config file on that.
...Their user/group lines are
User www
Group wwwSo if I run apache and php as a user that isn't root or nobody, will it work?
in order to do this the process you are running under requires read access to the directories you're listing - in this case I am not sure if it is the apache daemon or php itself.... but you need to have read access to what you're listing....
Offline