You are not logged in.

#1 2004-12-06 23:08:35

Atriqus
Member
From: Oscoda or Melbourne
Registered: 2004-02-15
Posts: 24

Something is wrong with php or me

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

#2 2004-12-06 23:20:48

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Something is wrong with php or me

sounds like a read permission problem to me....

Offline

#3 2004-12-06 23:29:59

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Something is wrong with php or me

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

#4 2004-12-07 00:47:16

Atriqus
Member
From: Oscoda or Melbourne
Registered: 2004-02-15
Posts: 24

Re: Something is wrong with php or me

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

#5 2004-12-07 02:23:27

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,622
Website

Re: Something is wrong with php or me

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

#6 2004-12-07 05:06:43

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Something is wrong with php or me

Atriqus wrote:

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?

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

Board footer

Powered by FluxBB