Re: [PHP-DEV] SSL streams switching to blocking socket
I found same problem in IIS recently. When SSL connection established and read to eof,I can't write anything to stream again. It's trow :SSL operation failed with code 1. OpenSSL Error messages: error:140D00CF:SSL routines:func(208):reason(207). My php version is 5.2.9 2009/9/8 Eloy Bote Falcon : > Hi everybody! > > Three months ago one of my PHP applications started to hang webserver > processes. The schema of the application is as follows (it's a webservice): > > -Main server, with LINUX, Apache and PHP, handles the requests from the > clients. > -Once the client is authenticated, and the request is valid, it relays the > request to one of the four slave servers (let's call them nodes). > -One of the nodes uses PHP4 (works fine), and the other three use LINUX, > Apache and PHP 5.1.6 with the following SSL configuration: > OpenSSL support => enabled > OpenSSL Version => OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 > > -The nodes send the request to a remote webservice, and reply it back to the > main server. > -The main server processes the response and sends back the response to the > client. > > > The problem is that, eventually, the PHP5 nodes ends with blocked (sleeping) > processes from Apache. Finally the system runs out of resources because all > the blocked-sleeping processes have a ESTABLISHED socket. > First I noticed that, at least in that version of PHP, the blocking sockets > can have a send and recive timeout. Then I switched to non blocking sockets > and select. Now the application works fine in the upper level of the > communication with the other webservices, but I noticed that it still ends > with sleeping processes. I "straced" the Apache and this is what I found > (the bound IP and the remote webservice IP are not real; the second one is > from google.com): > > Block 1 - > > 5503 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 20 > 5503 bind(20, {sa_family=AF_INET, sin_port=htons(0), > sin_addr=inet_addr("10.6.0.11")}, 16) = 0 > 5503 fcntl64(20, F_GETFL) = 0x2 (flags O_RDWR) > 5503 fcntl64(20, F_SETFL, O_RDWR|O_NONBLOCK) = 0 > 5503 connect(20, {sa_family=AF_INET, sin_port=htons(443), > sin_addr=inet_addr("74.125.127.100")}, 16) = -1 EINPROGRESS (Operation now > in progress) > 5503 poll([{fd=20, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 1370327) = 1 > ([{fd=20, revents=POLLOUT}]) > > Block 2 - > > 5503 getsockopt(20, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 > 5503 fcntl64(20, F_SETFL, O_RDWR) = 0 > 5503 time(NULL) = 1251911098 > 5503 brk(0xb9e39000) = 0xb9e39000 > 5503 time(NULL) = 1251911098 > 5503 write(20, > "\200d\1\3\1\0K\0\0\0\20\0\0009\0\0008\0\0005\0\0\26\0\0\23\0\0\n\7\0\300"..., > 102) = 102 > 5503 read(20, "\26\3\1\0J\2\0", 7) = 7 > 5503 time(NULL) = 1251911098 > 5503 time(NULL) = 1251911098 > 5503 read(20, > "\0F\3\1J\236\245\273^\v\375\357<\205\223\334n}\226k\232\\\311\300\21Q\256\267\304\257o#"..., > 72) = 72 > 5503 read(20, "\26\3\1\6\252", 5) = 5 > 5503 read(20, > "\v\0\6\246\0\6\243\0\3\2400\202\3\2340\202\3\5\240\3\2\1\2\2\4<\260Eh0\r\6"..., > 1706) = 1376 > 5503 read(20, " 2 CA1\r0\v\6\3U\4\3\23\4CRL10+\6\3U\35\20\4$0\"\200"..., > 330) = 330 > 5503 read(20, "\26\3\1\1^", 5) = 5 > 5503 read(20, "\r\0\1v\3\...@\1p\0m0k1\v0\t\6\3u\4\6\23\2es1\0170\r\6"..., > 350) = 350 > 5503 write(20, > "\26\3\1\0\7\v\0\0\3\0\0\0\26\3\1\0\206\20\0\0\202\0\200\215\30 > \tT\312\313\255\210"..., 210) = 210 > 5503 read(20, "\24\3\1\0\1", 5) = 5 > 5503 read(20, "\1", 1) = 1 > 5503 read(20, "\26\3\1\", 5) = 5 > 5503 read(20, > "\364\35k\17\25\224\314]|\263Y\307z\310\223\314\210\235h\224t\345\305\373\267\241\377\t\1s\345\250"..., > 48) = 48 > > Block 3 - > > 5503 fcntl64(20, F_GETFL) = 0x2 (flags O_RDWR) > 5503 fcntl64(20, F_SETFL, O_RDWR|O_NONBLOCK) = 0 > > Block 4 - > > 5503 select(21, [], [20], [], {44320, 0}) = 1 (out [20], left {44320, 0}) > 5503 gettimeofday({1251911098, 885029}, NULL) = 0 > 5503 write(13, "[Wed Sep 02 19:04:58 2009] [erro"..., 161) = 161 > 5503 write(20, > "\27\3\1\2\240\10\260\325k\v\37{\251\355t_R\274\312\16\354r\315\1\277\204b\342xU\30L"..., > 677) = 677 > 5503 select(21, [20], [], [], {44320, 0} > 5503 <... select resumed> ) = 1 (in [20], left {44319, 828000}) > 5503 read(20, "\27\3\1\0\240", 5) = 5 > 5503 read(20, > "\304\310\273s\370\304e\335\273\1\346\376N\234\376\226\276\0\fG9T\313\235\2&\31\340B=\f\""..., > 160) = 160 > 5503 select(21, [20], [], [], {44320, 0}) = 1 (in [20], left {44320, 0}) > 5503 read(20, "\27\3\1\4P", 5) = 5 > 5503 read(20, > "\333`\341\212},\215\3476\370\325\273\"\260\340\234\365\324\324\10a\25v\327\266'+\340\34\1\317\364"..., > 1104) = 1104 > > Block 5 - > > 5503 write(20, "\25\3\1\0 > \305\10\236\5\10\226JS\330\365\204\21\230\246\362\247R\332\220:\210o\2\333\10.\27"..., > 37) = 37 > 5503 brk(0xb9e2d0
[PHP-DEV] any solution about array_walk with pass-by-reference UseData?
In Online Document say's: Users may not change the array itself from the callback function. e.g. Add/delete elements, unset elements, etc. If the array that array_walk() is applied to is changed, the behavior of this function is undefined, and unpredictable. So I'm use Use Optional param( [, mixed $userdata ]) here is my code $return=array(); $disable_full=array('a','b','c'); $disable_start=array('_','!','HTTP'/*,'ddd','ddd','ddd','ddd','ddd'*/); $check_array=array("a"=>1,"_POST"=>'c',"HTTP"=>"f","ddd"=>array('fefe')); array_walk($check_array,'walk_fun_with_foreach',&$return); print_r($return); function walk_fun_with_foreach(&$source,$key,$return){ global $disable_full,$disable_start; //var_dump($key); if(is_array($source)){ array_walk($source,'walk_fun_with_foreach',&$return); }else{ if(in_array(strval($key),$disable_full)){ //exit; return; }else{ foreach($disable_start as $key1 => $value){ if(strpos($key,$value)===0){ //echo $key; return; } } } //echo $key; $return[$key]=$source; } } == it's print : Array ( [0] => fefe ) but in version php5.2.x and higher version,display Warning message: Warning: Call-time pass-by-reference has been deprecated in If I'm change array_walk($check_array,'walk_fun_with_foreach',&$return); to array_walk($check_array,'walk_fun_with_foreach',$return); and declare function like function walk_fun_with_foreach(&$source,$key,&$return) no Warning Display But result is not my needed. Anyone has solution about is?I'm don't like use foreach for instead,beacuse of some preformance reason. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Numerical string comparison - octal and hex.
I think it's not an but! you must read carefuly about "Single quoted" and "Double quoted" 2010/1/14 Richard Quadling : > Hello. > > In looking at numer vs string comparison, I think I've found an oddity. > > You can successfully compare hex strings ... > > var_dump(255 == '0xff'); > > but not octal strings ... > > var_dump(63 == '077'); > > > Is this a bug (lack of octal support) or an unexpected feature (hex support)? > > > Neither formats are documented in [1]. > > > Regards, > > Richard. > > [1] > http://docs.php.net/manual/en/language.types.string.php#language.types.string.conversion > -- > - > Richard Quadling > "Standing on the shoulders of some very clever giants!" > EE : http://www.experts-exchange.com/M_248814.html > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 > ZOPA : http://uk.zopa.com/member/RQuadling > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] about dl() in php6
In Online document about dl function http://www.php.net/manual/en/function.dl.php This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged. It's mean we can't Loads a PHP extension at runtime sine version 5.3.0 and higher version or it has another way to load extension at runtime? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] about dl() in php6(send again,some spell mistake before)
In Online document about dl function http://www.php.net/manual/en/function.dl.php This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged. It's means we can't Loads a PHP extension at runtime since version 5.3.0 and higher version ?Or it has another way to load extension at runtime in php6? -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [solved]about dl() in php6
Thanks Alexey Zakhlestin ,I'm kown very well all answer in your replies. 2010/1/17 Alexey Zakhlestin : > > On 17.01.2010, at 15:10, hack988 hack988 wrote: > >> thanks,but document say's dl() is not supported in multithreaded Web servers >> form php5.3.0 php not relase isapi in binary pack.It's means that php >> never support isapi module? If answer is yes,i have another question. > > yes. you can't use dl() in server-modules. > the reasoning for this is quite simple. server-processes are persistent and > if you load something via dl() it stays in server-process even after request > is finished. > which can lead to security problems, as other users of the server will have > this user-loaded extension too. > > to load extensions in such environments you need to use php.ini > >> Can I use dl() in Web servers with CGI module ? > > yes, you can. these are restarted after each request, so it is safe > >> I'm sorry for my bad english and puerilely question about dl(). >> I'm coded with php for several years,but never use dl before:(. > > no problem. > remember to use "reply to all" when writing to mailing-lists in future, or > lists won't get your replies. > > >> 2010/1/17 Alexey Zakhlestin : >>> >>> On 17.01.2010, at 14:46, hack988 hack988 wrote: >>> >>>> In Online document about dl function >>>> http://www.php.net/manual/en/function.dl.php >>>> This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of >>>> PHP 6.0.0. Relying on this feature is highly discouraged. >>>> >>>> >>>> It's mean we can't Loads a PHP extension at runtime sine version 5.3.0 >>>> and higher version or it has another way to load extension at runtime? >>> >>> it is disabled in mod_php and similar SAPIs. It is still available in CLI >>> and CGI >>> see http://www.php.net/manual/en/function.dl.php#function.dl.notes > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php