Re: php exec()
| From: | Zoltan Ormandi | Date: | Mon, 03 Nov 2008 08:26:18 +0000 |
| Subject: | Re: php exec() | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282782@lists.php.net to get a copy of this message | ||
Hi,
I'm not a Linux guru, so maybe my question is stupid, but are you sure the command prints its output to the *standard* output?
Z
cheesiong wrote:
hi ash, i tried you suggestion, with <?php exec('ipkg-cl --version >lalala.txt');?> the lalala.txt was created but the file is empty. anymore suggestion? thank you. regards,-keo On Mon, Nov 3, 2008 at 3:29 PM, Ashley Sheridan <ash@ashleysheridan.co.uk>wrote:muchOn Mon, 2008-11-03 at 15:21 +0800, cheesiong wrote:wrote:i found out that when execute ipkg, the return is before the header. root [ /srv/www/test ]# /program/php-5.2.6/bin/php-cgi ipkg.php ipkg version 0.99.163 X-Powered-By: PHP/5.2.6 Content-type: text/html Array ( ) which is different than the whoami program. root [ /srv/www/test ]# /program/php-5.2.6/bin/php-cgi whoami.php X-Powered-By: PHP/5.2.6 Content-type: text/html the result of execwhoami is root can you see the different? regards,-keo On Mon, Nov 3, 2008 at 2:12 PM, cheesiong <bluecolour.sz@gmail.com>hi Chris,phphi Chris, i did try, below is the continouos output from prompt when i do su. root [ /srv/www/test ]# su daemon root [ /srv/www/test ]# i didnt manage to switch user. i will create an user... so that i can switch to it. i created a user call lfs into group lfs. able to execute ipkg-cl and /program/..../ipkg-ck --version. then i change the httpd.conf to start apache with lfs and execute thescript to exec ipkg-cl --version. basically it is not working. root [ /srv/www/test ]# groupadd lfs root [ /srv/www/test ]# useradd -s /bin/bash -g lfs -m -k /dev/null lfs root [ /srv/www/test ]# passwd lfs Changing password for lfs Enter the new password (minimum of 5, maximum of 127 characters) Please use a combination of upper and lower case letters and numbers. New password: Bad password: too short. Warning: weak password (enter it again to use it anyway). New password: Re-enter new password: Password changed. root [ /srv/www/test ]# su lfs bash-3.2$ ipkg-cl --version ipkg version 0.99.163 bash-3.2$ /program/ipkg-0.99.163/bin/ipkg-cl --version ipkg version 0.99.163 bash-3.2$Change it, su, change it back. Looking at apache logs won't tell youlfs 13615 0.0 0.3 3684 1344 ? S 14:06 0:00/program/httpd-2.2.9/bin/lfs 13616 0.0 0.3 3684 1344 ? S 14:06 0:00/program/httpd-2.2.9/bin/lfs 13617 0.0 0.3 3684 1344 ? S 14:06 0:00/program/httpd-2.2.9/bin/lfs 13618 0.0 0.3 3684 1344 ? S 14:06 0:00/program/httpd-2.2.9/bin/lfs 13619 0.0 0.3 3684 1344 ? S 14:06 0:00/program/httpd-2.2.9/bin/ so not the user right problem, am i right ? regards,-keo On Mon, Nov 3, 2008 at 1:59 PM, Chris <dmagick@gmail.com> wrote:cheesiong wrote:my linux system is LFS that i build from scratch. i cant su to daemon. below is my /etc/passwd: root [ /srv/www/test ]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash nobody:x:99:99:Unprivileged User:/dev/null:/bin/false sshd:x:50:50:sshd PrivSep:/var/lib/sshd:/bin/false daemon:x:6:6:daemon:/dev/null:/bin/falsehi Chris,
What about making an exec call, but piping the results of that call to a text file. That way, it will be in a file that is easily accessed from other parts of your site. I'm not sure which is more expensive, a call to ifconfig, or a file read. Ash www.ashleysheridan.co.ukif you don't try something. Are you running selinux? <http://169.254.0.20>] /opt/ipkg-0.99.163/bin/ipkg-cl: PermissionThat one's pretty easy. -- Postgresql & php tutorials http://www.designmagick.com/denied, referer: http://169.254.0.101/test/