Reply to Re: [PHP] `ls -l /` does not reproduce same info than when executed in bash.

Your name:

Reply:


Posted by Hans Deragon on 10/04/73 11:10

Richard Lynch wrote:
>>BASH -------------------------------------------------------
>>lrwxrwxrwx 1 root root 28 Mar 3 07:25 app ->
>>/afs/sunrise.ericsson.se/app
>>drwxr-xr-x 2 root root 0 Mar 7 13:06 apps
>>lrwxrwxrwx 1 root root 24 Mar 7 14:11 archives ->
>
>
>>PHP --------------------------------------------------------
>>?--------- ? ? ? ? ? app
>>?--------- ? ? ? ? ? apps
>
>
> WILD GUESSES
>
> #1 (benign)
> Your 'apache' user on the bad box has some kind of cool shell color-coding
> going on.
>
> The color-coding puts out control characters for directories, users,
> permissions, and masks weird-o characters in filenames.
>
> Those control characters, when presented to you in a browser/text rather
> than a shell context, show up as funky-ass things like ? and that
> diamond-shaped inverse ? thing.
>
> You can diagnose this pretty easily, really.
>
> When you su to apache on the bad box and do "ls -ld /" do you get all
> kinds of pretty colors and stuff? Well, there ya go. Make it not do
> that.
>
> You're on your own figuring out how to do that. To me, it's just some
> magic that's sometimes on some Un*x boxes, and sometimes not, and that's
> how life goes. :-) [I don't care enough either way about the color-coding
> to find out, much less remember, how to change it either way.]
>
> #2 (panic)
> EXTREMELY UNLIKELY:
> You've been hacked and the 'ls' binary has been replaced with something
> that does something else very weird, but you don't see it under shell
> conditions...
> #1 is almost for sure the real answer...
> But if it's #2, you'd better act carefully.

Hi Richard.


Although "ls -ld /" returns some color, that is not the problem. I tried
within PHP `ls --color=never -ld /` and it fails to. ls is not the only
command having problems. I tried other commands like `find /lmw -name '*'`
and `cd /lmw` and they fail because of bad permissions.

Could it be because of SELinux? I wonder. I think that Apache runs under
some SELinux restrictions and that might be the problem. I will investigate
and report on this.


Ciao,
Hans Deragon
--
Consultant en informatique/Software Consultant
Deragon Informatique inc. Open source:
http://www.deragon.biz http://facil.qc.ca (Promotion du libre)
mailto://hans@deragon.biz http://autopoweroff.deragon.biz (Logiciel)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация