[PHP] Blocking gethostbyname and Net_DNS2 behaviour

2012-09-11 Thread a m
Hi,

I was using gethostbyname up until recently but switched to Net_DNS2
due to lack of support for a timeout. Now I discovered some "worrying"
behaviour and hope someone here get shed some light onto it.

I am running PHP inside an Apache 2 installation as module and noticed
that once I call gethostbyname it appears to block all other
concurrent independent requests to PHP pages until the call returned.
I do seem to remember that there were some reentrant issues with the
native gethostbyname function but I wouldnt assume there is some kind
of global lock on it blocking the entire runtime.

What is even more worrying is that Net_DNS2 appears to show the same
behaviour, even though from my understanding it is supposed to work
completely independent with its own streams/sockets.

Of course this behaviour only shows with a domain with non-responding
name servers, hence I used vuav.com. You should be able to reproduce
it easily with

['8.8.8.8']]);
$ans=$dr->query('vuav.com');
echo $ans->answer[0]->address;

?>

Could it have to do something with a configuration setting or might I
be onto something?

Thanks a lot!

cheers,
Alexander

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



confirm subscribe to php-general@lists.php.net

2012-09-11 Thread php-general-help
Hi! This is the ezmlm program. I'm managing the
php-general@lists.php.net mailing list.

I'm working for my owner, who can be reached
at php-general-ow...@lists.php.net.

To confirm that you would like

   arch...@mail-archive.com

added to the php-general mailing list, please send
an empty reply to this address:

   
php-general-sc.1347368255.dogihbdninpbhefjekdn-archive=mail-archive@lists.php.net

Usually, this happens when you just hit the "reply" button.
If this does not work, simply copy the address and paste it into
the "To:" field of a new message.

or click here:

mailto:php-general-sc.1347368255.dogihbdninpbhefjekdn-archive=mail-archive@lists.php.net

This confirmation serves two purposes. First, it verifies that I am able
to get mail through to you. Second, it protects you in case someone
forges a subscription request in your name.

Some mail programs are broken and cannot handle long addresses. If you
cannot reply to this request, instead send a message to
 and put the
entire address listed above into the "Subject:" line.


--- Administrative commands for the php-general list ---

I can handle administrative requests automatically. Please
do not send them to the list address! Instead, send
your message to the correct command address:

For help and a description of available commands, send a message to:
   

To subscribe to the list, send a message to:
   

To remove your address from the list, just send a message to
the address in the ``List-Unsubscribe'' header of any list
message. If you haven't changed addresses since subscribing,
you can also send a message to:
   

or for the digest to:
   

For addition or removal of addresses, I'll send a confirmation
message to that address. When you receive it, simply reply to it
to complete the transaction.

If you need to get in touch with the human owner of this list,
please send a message to:



Please include a FORWARDED list message with ALL HEADERS intact
to make it easier to help you.

--- Enclosed is a copy of the request I received.

Return-Path: 
Received: (qmail 4126 invoked from network); 11 Sep 2012 12:57:35 -
Received: from unknown (HELO lists.php.net) (127.0.0.1)
  by localhost with SMTP; 11 Sep 2012 12:57:35 -
Return-Path: 
Authentication-Results: pb1.pair.com smtp.mail=nore...@php.net; spf=unknown; 
sender-id=unknown
Authentication-Results: pb1.pair.com header.from=arch...@mail-archive.com; 
sender-id=softfail
Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 
140.211.15.143 as permitted sender)
X-PHP-List-Original-Sender: nore...@php.net
X-Host-Fingerprint: 140.211.15.143 osu1php.osuosl.org  
Received: from [140.211.15.143] ([140.211.15.143:57971] helo=osu1php.osuosl.org)
by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP
id C3/A2-24398-E353F405 for 
; Tue, 11 Sep 
2012 08:57:35 -0400
Authentication-Results: osu1php.osuosl.org smtp.mail=nore...@php.net; 
spf=neutral; sender-id=neutral
Authentication-Results: osu1php.osuosl.org 
header.from=arch...@mail-archive.com; sender-id=softfail
Received-SPF: neutral (osu1php.osuosl.org: 127.0.0.1 is neither permitted nor 
denied by domain of php.net)
Received: from [127.0.0.1] ([127.0.0.1:60108] helo=localhost)
by osu1php.osuosl.org (envelope-from )
(ecelerity 3.3.2.44647 r(44647)) with ESMTP
id 39/D0-30231-A353F405; Tue, 11 Sep 2012 12:57:30 +
Date: Tue, 11 Sep 2012 12:57:30 +
Message-ID: <39.d0.30231.a353f...@osu1php.osuosl.org>
X-Authentication-Warning: osu1php.osuosl.org: nobody set sender to 
nore...@php.net using -f
To: php-general-subscribe-archive=mail-archive@lists.php.net
Subject: PHP Mailing List Website Subscription
X-PHP-Originating-Script: 0:subscribe.php
From: arch...@mail-archive.com

This was a request generated from the form at 
http://www.php.net/mailing-lists.php by 109.61.3.34.



[PHP] Re: Blocking gethostbyname and Net_DNS2 behaviour

2012-09-11 Thread a m
My apologies, it looks like it was a false alarm and the blocking
actually comes from PHP's session manager.

Sorry,
Alexander

On 11 September 2012 14:22, a m  wrote:
> Hi,
>
> I was using gethostbyname up until recently but switched to Net_DNS2
> due to lack of support for a timeout. Now I discovered some "worrying"
> behaviour and hope someone here get shed some light onto it.
>
> I am running PHP inside an Apache 2 installation as module and noticed
> that once I call gethostbyname it appears to block all other
> concurrent independent requests to PHP pages until the call returned.
> I do seem to remember that there were some reentrant issues with the
> native gethostbyname function but I wouldnt assume there is some kind
> of global lock on it blocking the entire runtime.
>
> What is even more worrying is that Net_DNS2 appears to show the same
> behaviour, even though from my understanding it is supposed to work
> completely independent with its own streams/sockets.
>
> Of course this behaviour only shows with a domain with non-responding
> name servers, hence I used vuav.com. You should be able to reproduce
> it easily with
>
> 
> echo gethostbyname('vuav.com');
>
> // OR ..
>
> require('Net/DNS2.php');
>
> $dr=new Net_DNS2_Resolver(['nameservers'=>['8.8.8.8']]);
> $ans=$dr->query('vuav.com');
> echo $ans->answer[0]->address;
>
> ?>
>
> Could it have to do something with a configuration setting or might I
> be onto something?
>
> Thanks a lot!
>
> cheers,
> Alexander

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] redirect a shell command to stdout in real time

2012-09-11 Thread zonyi besk
Hi All,

I want to redirect the stdout of an executing shell command to stdout of
php called by browser
The command some stream like command like
ffmpeg -i rtmp://192. -
rtmpdump -v  -r rtmp://192  -a app -y stream -o -
so its live video, and the execution not stops,  till the user navigate out
with browser.

What I want loading this php from web based,  to print the live video
content to the stdout of php,
So the call result of  php is video and starts almost with
header("Content-Type: video/x-flv");

Hope there's solution in php
Thanks
Zocs


Re: [PHP] redirect a shell command to stdout in real time

2012-09-11 Thread shiplu
You can use pipe to run the command and capture the stdout.
Then dump it with proper header to browser.

Note, If the external command (specially video encoding) takes long time
you should probably use cron for this and maintain a queue. I recommend you
apply some sorts of caching also.

-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader


[PHP] fets() escaping some characters

2012-09-11 Thread sunil meena
Hello Everyone,

Very new to the list.

So I am trying to echo a string to the browser as follows -

$str = "0x100092000 -0x1000b7fff +com.apple.com (2.0 - 56)
 /Library/PrivateFrameworks";

echo $str;

However the text between "<" and ">" i.e
"BB91F4F8-3B1B-93C6-0D1A-E431E96F1BA3" doesn't get echoed instead all I get
is "0x100092000 -0x1000b7fff +com.apple.com (2.0 - 56)
/Library/PrivateFrameworks";

Anyone knows why this is happening?

This happened while I was getting a line using fgets and hence I tried
storing that string into a variable and outputting but it still doesn't
show the characters between the "<>".

Any help is highly appreciated.

Thanks

-- 
Best Regards,
Sunil Meena


RES: [PHP] fets() escaping some characters

2012-09-11 Thread Samuel Lopes Grigolato
This issue has to do with HTML markup. You need to properly "escape"
characters before sending them as text to the browser. Try to use this PHP
function to escape your string: echo htmlspecialchars($yourstringhere);

Regards,
Samuel.

-Mensagem original-
De: sunil meena [mailto:sunil.extc2...@gmail.com] 
Enviada em: terça-feira, 11 de setembro de 2012 14:49
Para: php-general@lists.php.net
Assunto: [PHP] fets() escaping some characters

Hello Everyone,

Very new to the list.

So I am trying to echo a string to the browser as follows -

$str = "0x100092000 -0x1000b7fff +com.apple.com (2.0 - 56)
 /Library/PrivateFrameworks";

echo $str;

However the text between "<" and ">" i.e
"BB91F4F8-3B1B-93C6-0D1A-E431E96F1BA3" doesn't get echoed instead all I get
is "0x100092000 -0x1000b7fff +com.apple.com (2.0 - 56)
/Library/PrivateFrameworks";

Anyone knows why this is happening?

This happened while I was getting a line using fgets and hence I tried
storing that string into a variable and outputting but it still doesn't show
the characters between the "<>".

Any help is highly appreciated.

Thanks

--
Best Regards,
Sunil Meena


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fets() escaping some characters

2012-09-11 Thread sunil meena
Thanks a ton Samuel!

Appreciate it.

On Tue, Sep 11, 2012 at 10:54 AM, Samuel Lopes Grigolato <
samuel.grigol...@gmail.com> wrote:

> This issue has to do with HTML markup. You need to properly "escape"
> characters before sending them as text to the browser. Try to use this PHP
> function to escape your string: echo htmlspecialchars($yourstringhere);
>
> Regards,
> Samuel.
>
> -Mensagem original-
> De: sunil meena [mailto:sunil.extc2...@gmail.com]
> Enviada em: terça-feira, 11 de setembro de 2012 14:49
> Para: php-general@lists.php.net
> Assunto: [PHP] fets() escaping some characters
>
> Hello Everyone,
>
> Very new to the list.
>
> So I am trying to echo a string to the browser as follows -
>
> $str = "0x100092000 -0x1000b7fff +com.apple.com (2.0 - 56)
>  /Library/PrivateFrameworks";
>
> echo $str;
>
> However the text between "<" and ">" i.e
> "BB91F4F8-3B1B-93C6-0D1A-E431E96F1BA3" doesn't get echoed instead all I get
> is "0x100092000 -0x1000b7fff +com.apple.com (2.0 - 56)
> /Library/PrivateFrameworks";
>
> Anyone knows why this is happening?
>
> This happened while I was getting a line using fgets and hence I tried
> storing that string into a variable and outputting but it still doesn't
> show
> the characters between the "<>".
>
> Any help is highly appreciated.
>
> Thanks
>
> --
> Best Regards,
> Sunil Meena
>
>


-- 
Best Regards,
Sunil Meena


Re: RES: [PHP] fets() escaping some characters

2012-09-11 Thread Marco Behnke
Or, if that string is the only thing you want to output and nothing else
you will set the correct content type for your output by putting

header('Content-Type: text/plain; charset=utf-8');

at the beginning of your script

Am 11.09.12 19:54, schrieb Samuel Lopes Grigolato:
> This issue has to do with HTML markup. You need to properly "escape"
> characters before sending them as text to the browser. Try to use this PHP
> function to escape your string: echo htmlspecialchars($yourstringhere);
>
> Regards,
> Samuel.
>
> -Mensagem original-
> De: sunil meena [mailto:sunil.extc2...@gmail.com] 
> Enviada em: terça-feira, 11 de setembro de 2012 14:49
> Para: php-general@lists.php.net
> Assunto: [PHP] fets() escaping some characters
>
> Hello Everyone,
>
> Very new to the list.
>
> So I am trying to echo a string to the browser as follows -
>
> $str = "0x100092000 -0x1000b7fff +com.apple.com (2.0 - 56)
>  /Library/PrivateFrameworks";
>
> echo $str;
>
> However the text between "<" and ">" i.e
> "BB91F4F8-3B1B-93C6-0D1A-E431E96F1BA3" doesn't get echoed instead all I get
> is "0x100092000 -0x1000b7fff +com.apple.com (2.0 - 56)
> /Library/PrivateFrameworks";
>
> Anyone knows why this is happening?
>
> This happened while I was getting a line using fgets and hence I tried
> storing that string into a variable and outputting but it still doesn't show
> the characters between the "<>".
>
> Any help is highly appreciated.
>
> Thanks
>
> --
> Best Regards,
> Sunil Meena
>
>


-- 
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz




signature.asc
Description: OpenPGP digital signature