Re: `ls -l /` does not reproduce same info than when executed in bash. - SOLVED

From: Date: Fri, 11 Mar 2005 17:51:28 +0000
Subject: Re: `ls -l /` does not reproduce same info than when executed in bash. - SOLVED
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210526@lists.php.net to get a copy of this message
Greetings. My problem with permissions when running an external executable like 'ls' under PHP, itself running under Apache on an Fedora Core 3 (FC3) machine has been solved. I disabled SELinux and everything is now working fine. SELinux prevents apache to access some directories, notably NFS mounted shares. Thanks to all who attempted to help me solve this problem. Best regards, 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)
Hans Deragon wrote:
Greetings. When running "ls -ld /" under bash, I get a normal directory output. However, when I run ls -ld / under php (running under Apache 2.0.52), I get many entries with "?" in their fields and permissions all closed. What causes this? I did "su - apache" to switch to the same user under which the Apache server is running and tried the "ls -ld /" under bash, and it worked fine. Thus the server's has all the permissions to read the root directory. Yet PHP does not seam to have these permissions. This occurs on one of my FC3 machine. On another FC3 machine, php behaves correctly. Following the output of "ls -ld \" under bash and PHP: 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 -> /users/qhander/downloads
drwxr-xr-x    2 root    root    4096 Mar  8 04:53 bin
drwxr-xr-x    3 root    root    4096 Mar  7 11:11 boot
drwxr-xr-x    2 root    root       0 Mar  7 13:06 cctest
drwxr-xr-x    9 root    root    4760 Mar  8 12:58 dev
drwxr-sr-x 30 qhander floppy 4096 Feb 28 16:19 devel
lrwxrwxrwx    1 root    root      28 Mar  3 07:25 env -> /afs/sunrise.ericsson.se/env
drwxr-xr-x   86 root    root   12288 Mar  9 16:43 etc
drwxr-xr-x    2 root    root    4096 Mar  8 17:04 export
drwxr-xr-x    3 qhander floppy  4096 Mar  8 13:51 hans
drwxr-xr-x    3 root    root       0 Mar  3 12:52 home
drwxr-xr-x    2 root    root    4096 Aug 12  2004 initrd
drwxr-xr-x   11 root    root    4096 Mar  8 04:41 lib
drwxr-xr-x 12 58094 5000 4096 Mar 7 16:27 lmw
drwxr-xr-x    4 root    root    4096 Mar  3 07:25 local
drwx------    2 root    root   16384 Mar  3 06:43 lost+found
drwxr-xr-x    4 root    root    4096 Mar  7 11:17 media
drwxr-xr-x    2 root    root       0 Mar  7 13:06 MMS
drwxr-xr-x    3 root    root    4096 Mar  7 13:34 mnt
drwxr-xr-x    2 root    root       0 Mar  7 13:06 net
drwxr-xr-x    2 root    root    4096 Aug 12  2004 opt
drwxr-xr-x    2 root    root       0 Mar  7 13:06 prj
dr-xr-xr-x  226 root    root       0 Mar  3 07:25 proc
drwxr-xr-x    2 root    root       0 Mar  7 13:06 project
drwxr-xr-x    4 root    root       0 Mar  9 16:43 pub
drwxr-x---   17 root    root    4096 Mar  9 16:43 root
drwxr-xr-x    2 root    root   12288 Mar  8 04:55 sbin
drwxr-xr-x    1 root    root       0 Mar  3 07:25 selinux
drwxr-xr-x    2 root    root    4096 Aug 12  2004 srv
drwxr-xr-x    9 root    root       0 Mar  3 07:25 sys
drwxrwxrwt   29 root    root    4096 Mar  9 16:46 tmp
drwxr-xr-x    5 root    root    4096 Oct 18 16:14 users
drwxr-xr-x   14 root    root    4096 Mar  3 07:25 usr
drwxr-xr-x   24 root    root    4096 Mar  3 14:56 var
<---- PHP --------------------------------------------------------
?---------    ? ?        ?          ?            ? app
?---------    ? ?        ?          ?            ? apps
?---------    ? ?        ?          ?            ? archives
drwxr-xr-x    2 lmwadmin root    4096 mar  8 04:53 bin
?---------    ? ?        ?          ?            ? boot
?---------    ? ?        ?          ?            ? cctest
drwxr-xr-x    9 lmwadmin root    4760 mar  8 12:58 dev
?---------    ? ?        ?          ?            ? devel
?---------    ? ?        ?          ?            ? env
drwxr-xr-x 86 lmwadmin root 12288 mar 9 16:25 etc
drwxr-xr-x    2 lmwadmin root    4096 mar  8 17:04 export
drwxr-xr-x    3 qhander  floppy  4096 mar  8 13:51 hans
?---------    ? ?        ?          ?            ? home
drwxr-xr-x    2 lmwadmin root    4096 ao� 12  2004 initrd
drwxr-xr-x   11 lmwadmin root    4096 mar  8 04:41 lib
?---------    ? ?        ?          ?            ? lmw
drwxr-xr-x    4 lmwadmin root    4096 mar  3 07:25 local
?---------    ? ?        ?          ?            ? lost+found
?---------    ? ?        ?          ?            ? media
?---------    ? ?        ?          ?            ? MMS
?---------    ? ?        ?          ?            ? mnt
?---------    ? ?        ?          ?            ? net
drwxr-xr-x    2 lmwadmin root    4096 ao� 12  2004 opt
?---------    ? ?        ?          ?            ? prj
dr-xr-xr-x  222 lmwadmin root       0 mar  3 07:25 proc
?---------    ? ?        ?          ?            ? project
?---------    ? ?        ?          ?            ? pub
drwxr-x---   17 lmwadmin root    4096 mar  9 16:19 root
drwxr-xr-x    2 lmwadmin root   12288 mar  8 04:55 sbin
?---------    ? ?        ?          ?            ? selinux
?---------    ? ?        ?          ?            ? srv
?---------    ? ?        ?          ?            ? sys
drwxrwxrwt   29 lmwadmin root    4096 mar  9 16:06 tmp
?---------    ? ?        ?          ?            ? users
drwxr-xr-x   14 lmwadmin root    4096 mar  3 07:25 usr
?---------    ? ?        ?          ?            ? var
Best regards, Hans Deragon


« previous php.general (#210526) next »