[PHP] php5/cli/cgi/stdin/signal bug ?

2004-07-19 Thread franck
on php5.0.0,

I would like to have php core team opinion on this :
- cli version loose stdin when using pcntl_signal,  but it's NOT possible to
recover it
- cgi version loose stdin when using pcntl_signal,  and it's possible to
recover it

If it's not a bug, i just would like to understand ;)


Little test script :

?php

// Use this little test script like that :
// while :; do date; sleep 1; done | php ./test2.php

function sig_handler($signo) {
global $stdin;
print Caught SIGALM...\n;
pcntl_alarm(3);

// For explain line below, see http://bugs.php.net/bug.php?id=26838
// signals make STDIN become EOF

$stdin = fopen(php://stdin, 'r') or die('1');
}

print Installing signal handler...\n;
pcntl_signal(SIGALRM, sig_handler);
print Generating signal SIGTERM to self...\n;

declare(ticks=1);
pcntl_alarm(3);
$stdin = fopen(php://stdin, 'r') or die('1');
while (!feof($stdin)) {
echo fgets($stdin);
}

print Done\n




/*

// Using PHP-5.0.0(cgi) --enable-cgi --enable-fastcgi, $stdin is recover
when sig_handler called

// WORK

Output:

[EMAIL PROTECTED] while :; do date; sleep 1; done | php-cgi ./test2.php
Content-type: text/html; charset=UTF-8

Installing signal handler...
Generating signal SIGTERM to self...
lun jui 19 16:23:38 CEST 2004
lun jui 19 16:23:39 CEST 2004
lun jui 19 16:23:40 CEST 2004
lun jui 19 16:23:41 CEST 2004
Caught SIGALM...
lun jui 19 16:23:42 CEST 2004 // !feof stdin, continu while() ;)
lun jui 19 16:23:44 CEST 2004




// Using PHP-5.0.0(cli) --disable-cgi --disable-fastcgi, $stdin is NOT
recover when sig_handler called

// -- ERROR ?

Output :

[EMAIL PROTECTED] while :; do date; sleep 1; done | php-cli ./test2.php
Installing signal handler...
Generating signal SIGTERM to self...
lun jui 19 16:23:26 CEST 2004
lun jui 19 16:23:27 CEST 2004
lun jui 19 16:23:28 CEST 2004
lun jui 19 16:23:29 CEST 2004
Caught SIGALM...
Done // feof stdin -- end of program

*/
?

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



[PHP] Re: php5/cli/cgi/stdin/signal bug ?

2004-07-19 Thread franck

When using /dev/fd/0 (not php://stdin) in the two fopen functions,
it works perfectly with cli AND cgi version 

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



Re: [PHP] SNMP traps generation

2004-07-16 Thread franck
If you find something, it's interesting me !!

Because of ASN1 encryption, it's hard to send a simple SNMP Trap
with somes lines of code.



Alessandro Vitale [EMAIL PROTECTED] a écrit dans le message de
news:[EMAIL PROTECTED]
 Hi all,
 does anybody know any good library (class|script) for generating SNMP
traps
 wirtten in PHP?
 thanks in advance,

 A.


 ***
  Alessandro Vitale
  Jr. Software Engineer
  Tiscali International Network Spa
  +39 070 4601678
  [EMAIL PROTECTED]
 ***

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



[PHP] php5.0.0(cli) + loose STDIN when using pcntl_alarm

2004-07-16 Thread franck
My goal is to parse apache log into a php piped program.

I need pcntl_alarm to launch some function, while reading stdin.

When exiting of pcntl_alarm function handler, i loose STDIN,
php say it's a valid resource, but feof found, since data continu
to be send into the pipe.

With php5-rc1 it was working, using fopen(php://stdin,r);
With php5-rc2,rc3,0.0.0, it doesn't work, using STDIN

I think it's a bug but i'm not sure, please correct me if a make
a nonsense.

- You will find php sample code at http://exeprod.com/test_cli_signal.txt

- To use it you just make something like that :
 while :; do date; sleep 1; done | /usr/local/bin/php test_cli_signal.php

- It will give you output like :
sam jui 17 01:29:48 CEST 2004
sam jui 17 01:29:49 CEST 2004
sam jui 17 01:29:50 CEST 2004
je passe dans sig_handler (14)   -- sig_handler() function
Already reading from stdin-- read_stdin() function
exiting read_stdin()
STDIN: Resource id #1
is_resource(STDIN)=1



Any help will be very appreciated.
Critical for me

Thanks in advanced.

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



[PHP] problem with apache 2.0

2003-06-03 Thread Franck Collineau
Greeting,

I have just change my server to apache 2.0.44 and php 4.3.1 (from mandrake 
9.1) and i have a problem now


When i pass a numeric parameter to a  php script from a form, the parameter is 
equal zero !

Here is my form:
p  Modification d'un matériel: /p

table
tr
td align=rightNuméro: /td
tdform action=edit.php method=POST  target=bas name=forme
input type=text name=id size=3/td
tdinput value=Modifier type=submit/td
/form
/tr
/table


here is my script php:

?
   $taille=strlen($id);
print(ident: $id br);
$id=(int) $id;
?


where does the problem come from ?


Thanks
Franck

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



[PHP] How printing the name and value of a variable ?

2002-10-31 Thread franck raynal
Hello, 
I'd like to print the name of a variable, in order to get something like this  : 
 
THE VARIABLE tigidizougou EQUALS 12 !
 
from the original code below :
 
$tigidizougou = 12;
echo THE VARIABLE .(please help me right here). EQUALS .$tigidizougou;
 
Any idea ? Thanks you. 
 
Franck


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