ID: 15157
Updated by: torben
Old Summary: exec()/system() doesn't work with parameters in
quotation-marks in system-call
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Feedback
Bug Type: Program Execution
Operating System: Linux (Debian) / Solaris 8
PHP Version: 4.1.0
New Comment:

I don't get anything weird on PHP 4.2.0-dev with this
script:

<?php
error_reporting(E_ALL);

exec('whois -h whois.denic.de "Penelope Cruz"', $output);

print_r($output);

?>

The above outputs the same thing as running the command at
the prompt. What do you get from the above script?


Torben


Previous Comments:
------------------------------------------------------------------------

[2002-01-22 03:12:55] [EMAIL PROTECTED]

The exec/system-Functions don't work with calls like this:

whois -h whois.denic.de "Penelope Cruz"

The problem is the string "Penelope Cruz", which has to be one
parameter for the whois-function. Without quotation marks, the string
is used as two parameters - even when they're connected with "\ " ->
("Penelope\ Cruz").
And with quotation marks, PHP executes the command with "Penelope Cruz"
as one string, BUT WITH the quotation marks included.

I tried several other ways (with system(), too), but none of them
worked:
exec("whois -h whois.denic.de Penelope\ Cruz");
exec("whois -h whois.denic.de \"Penelope\ Cruz\"");
exec("whois -h whois.denic.de \"Penelope Cruz\"");
exec("whois -h whois.denic.de 'Penelope\ Cruz'");
exec("whois -h whois.denic.de ".'"'."Penelope Cruz".'"'.");
...

My config:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs'
'--with-zlib=/usr' '--with-curl=/usr/local'
'--with-mysql=/usr/local/mysql' '--with-ldap=/usr/local'
'--with-openssl' '--enable-ftp'

The problem was the same with Linux (Debian Potato) and Solaris8

Greets,
   Oliver.

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=15157&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to