ID: 15157 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Program Execution Operating System: Linux (Debian) / Solaris 8 PHP Version: 4.1.0 New Comment:
I did cut an paste your Script. On the Debian-System (which is not authorized @denic to search for a person) it returns on line 14: % No entries found for the selected source: ""Dirk Janssen"" It seems as if the quotation marks are passed thru. When I call the command on the shell, it returns (line 14 again): % No entries found for the selected source: "Dirk Janssen" Watch the quotation marks! And that's the problem (maybe a bug) I think. The result in the shell is ok, since the host is not authorized to search for people. On the authorized solaris-box, the whois-call on the shell returns the DENIC-Handle, etc. The exec()-call (your cut'n'pasted script with "Dirk Janssen" as searchstring) returns nothing. If I try it with "test.de", which returns the info for the domain on the shell-call, the PHP-Script returns the well-known output on line 14: % No entries found for the selected source: ""test.de"" Once again, PHP seems to have a problem with the quotation-marks. Ok, there is a difference: The quotation marks should not be passed through to the whois-command. What whois needs is a parameter which has the string 'Dirk Janssen' as value. PHP seems to send the string with the quotation-marks - or when I try it without them - as two separated parameters to the whois-function. Even if I try to connect the two words with an '\ ' (escaped space). By the way, the escaped space works on the shell: shell> whois -h whois.denic.de Dirk\ Janssen I don't know. I now do the whois-query through the socket, which is a much better way then the exec()-alternative. But there must be a way to do it with the exec()-command..... Oliver. Previous Comments: ------------------------------------------------------------------------ [2002-01-22 04:11:39] [EMAIL PROTECTED] I'm running Debian here. Can you actually cut and paste the script I posted before, and try it? The lines you posted before wouldn't actually produce any output, which is why I'm wondering... Torben ------------------------------------------------------------------------ [2002-01-22 04:01:37] [EMAIL PROTECTED] I tried it, but with PHP I got an empty output from the system-call, which is the same with wrong parameters for the whois-function. I tried exactly the same script you posted. There is no difference from my experience. May there be a difference with Solaris/Debian/PHP4.1 and your setup? Please try "Dirk Janssen" in the whois-query, which returns a valid denic-result, BUT ONLY if you have a registered host for this query. I think it's a PHP-Bug, caus the call in the shell returns the right result. Greetings, Oliver. ------------------------------------------------------------------------ [2002-01-22 03:20:22] [EMAIL PROTECTED] you have to use double \\ to pass a \ to the executing shell as \ is the php escape character, too ------------------------------------------------------------------------ [2002-01-22 03:20:21] [EMAIL PROTECTED] 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 ------------------------------------------------------------------------ [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]