RE: [PHP-INST] cannot read output with fgets() from popen()
| From: | Jonathan Hilgeman | Date: | Tue, 20 Nov 2001 18:59:09 +0000 |
| Subject: | RE: [PHP-INST] cannot read output with fgets() from popen() | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-5044@lists.php.net to get a copy of this message | ||
What's with the extra pair of parentheses?
> $fp = popen("/bin/ls"),"r");
Change it to:
> $fp = popen("/bin/ls","r");
- Jonathan
-----Original Message-----
From: Jim Barcelona [mailto:jim.barcelona@maguma.com]
Sent: Tuesday, November 20, 2001 11:03 AM
To: simeon@nbermuda.ch
Cc: php-install@lists.php.net
Subject: Re: [PHP-INST] cannot read output with fgets() from popen()
Try:
<?php
$fp = popen(("/bin/ls"),"r");
while (!feof ($fp))
{
$retvalue = fgets($fp, 4096);
print $retvalue;
}
pclose($fp);
?>
Instead.
simeon@nbermuda.ch wrote:
> i try to:
>
> $fp = popen("/bin/ls"),"r");
> $retvalue = fgets($fp, 4096);
> pclose($fp);
> print $retvalue;
>
> why $retvalue is always "" (blank)? config is: apache, php, suse... all
> newer versions... and standard configurations... apache runs on a
specified
> user. does apache needs root rights or suid on shell? target command?
>
> pleas help, tia.
> simeon.
>
> --
> PHP Install Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net
> For additional commands, e-mail: php-install-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Jim Barcelona mailto:jim.barcelona@maguma.com
+39 3484 22 56 77 -- better living through php
--
PHP Install Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-install-unsubscribe@lists.php.net
For additional commands, e-mail: php-install-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net