Record php5.4 and php-redis conflict resolution

Source: Internet
Author: User
Tags lstat connection reset
Recently, the ubuntu source is updated, causing some lib conflicts between the original new source and the local system Library. as a result, the system desktop displays an exception. later, only the new version is installed, phpbench is installed, and redis is also installed, php-redis extension, php-redis extension 2, 10. However, when I put the original project on, I reported that n recently updated the ubuntu source, resulting in some lib conflicts between the original new source and the local system Library, leading to abnormal display on the system desktop. later, I only re-installed it, php5.4.9 is installed, redis, php-redis extension, and php-redis extension 2 and 10 are also installed. However, once the original project is put up, the nginx 502 error will be reported (nginx 502 error is a headache ). Open nginx log to view [error] 29229 #0: * 1403 recv () failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: do not know the cloud. Then open the php-fpm error log and obtain the log [21:22:23] WARNING: [pool www] child 12026 exited on signal 11 (SIGSEGV-core dumped) after 5.997917 seconds from start [08-Oct-2013 21:22:23] NOTICE: [pool www] child 12034 started can be determined that php-fpm restarts a process after a time point. There is no clue. I searched the internet a lot and found a useful tracking method. 1. set php-fpm to start only one work process. 2. restart php-fpm, run ps aux | grep php-fpm to get the work process id pid 3. under strace-p pid, the following information is obtained: getcwd ("/home/www/wms2.xxxx.com", 4096) = 26 lstat ("/home/www/Taobao", 0x7ffff4e30a10) =-1 ENOENT (No such file or directory) lstat ("/home/www/Taobao", 0x7ffff4e30a10) =-1 ENOENT (No such file or directory) lstat ("/home/www/wms2. Dependencies ", 0x7ffff4e30a10) =-1 ENOENT (No such file or directory) lstat ("/home/www/logs ", 0x7ffff4e30a10) =-1 ENOENT (No such file or directory) lstat ("/home/www/wms2.xiaomi.com/protected/modules/rights/components/RWebUser.php", {st_mode = S_IFREG | 0777, st_size = 2945 ,...}) = 0 lstat ("/home/www/wms2.xiaomi.com/prot Ected/modules/rights/components ", {st_mode = S_IFDIR | 0777, st_size = 4096 ,...}) = 0 lstat ("/home/www/wms2.xiaomi.com/protected/modules/rights", {st_mode = S_IFDIR | 0777, st_size = 4096 ,...}) = 0 lstat ("/home/www/wms2.xiaomi.com/protected/modules", {st_mode = S_IFDIR | 0777, st_size = 4096 ,...}) = 0 open ("/home/www/wms2.xiaomi.com/protected/modules/rights/components/RWebUser.php", O_RDONLY) = 5 fstat (5, {st_mo De = S_IFREG | 0777, st_size = 2945 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2945 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2945 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2945 ,...}) = 0 mmap (NULL, 2945, PROT_READ, MAP_SHARED, 5, 0) = 0x7fd9b4804000 mmap (NULL, 266240, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS,-1, 0) = 0x7fd9b442f000 munmap (0x7fd9b4804000, 2945) = 0 clo Se (5) = 0 getcwd ("/home/www/wms2.xxx.com", 4096) = 26 lstat ("/home/www/wms2.xxx.com/./XMCCacheHttpSession.php", 0x7ffff4e31060) =-1 ENOENT (No such file or directory) lstat ("/home/www/logs", 0x7ffff4e31060) =-1 ENOENT (No such file or directory) lstat ("/home/www/wms2.xxx.com/protected/vendor/wms/XMCCacheHttpSession.php", 0x7ffff4e31060) = -1 ENOENT (No such file or directory) lstat ("/home/www/logs", 0x7ffff4e31060) =-1 ENOENT (No such file or directory) lstat ("/home/www/Taobao", 0x7ffff4e31060) =-1 ENOENT (No such file or directory) lstat ("/home/www/Taobao P ", 0x7ffff4e31060) =-1 ENOENT (No such file or directory) lstat ("/home/www/logs ", {st_mode = S_IFREG | 0777, st_size = 2612 ,...}) = 0 open ("/home/www/logs", O_RDONLY) = 5 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2612 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2612 ,...}) = 0 fstat (5, {st_m Ode = S_IFREG | 0777, st_size = 2612 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2612 ,...}) = 0 mmap (NULL, 2612, PROT_READ, MAP_SHARED, 5, 0) = 0x7fd9b4804000 munmap (0x7fd9b4804000, 2612) = 0 close (5) = 0 sendto (4, "get 6cacd9674ad21aa083b5032b1a29 "..., 39, MSG_DONTWAIT | MSG_NOSIGNAL, NULL, 0) = 39 recvfrom (4, 0x2806d88, 8196, 64, 0, 0) =-1 EAGAIN (Resource temporarily unavailable) poll ([{fd = 4, Events = POLLIN}], 1, 5000) = 1 ([{fd = 4, revents = POLLIN}]) recvfrom (4, "VALUE 6cacd9674ad21aa083b5032b1a "..., 8196, MSG_DONTWAIT, NULL, NULL) = 128 lstat ("/home/www/wms2.xxx.com/yii/web/CHttpCookie.php", {st_mode = S_IFREG | 0777, st_size = 2772 ,...}) = 0 lstat ("/home/www/wms2.xxx.com/yii/web", {st_mode = S_IFDIR | 0777, st_size = 4096 ,...}) = 0 open ("/home/www/wms2.xxx.com/yii/web/CHttpCookie.php", O_RDONLY) = 5 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2772 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2772 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2772 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2772 ,...}) = 0 mmap (NULL, 2772, PROT_READ, MAP_SHARED, 5, 0) = 0x7fd9b4804000 munmap (0x7fd9b4804000, 2772) = 0 close (5) = 0 stat ("/home/www/wms2.xxx.com/protected/extensions/redis/XMRedi S. php ", {st_mode = S_IFREG | 0777, st_size = 2672 ,...}) = 0 lstat ("/home/www/wms2.xxx.com/protected/extensions/redis/XMRedis.php", {st_mode = S_IFREG | 0777, st_size = 2672 ,...}) = 0 lstat ("/home/www/wms2.xxx.com/protected/extensions/redis", {st_mode = S_IFDIR | 0777, st_size = 4096 ,...}) = 0 lstat ("/home/www/wms2.xxx.com/protected/extensions", {st_mode = S_IFDIR | 0777, st_size = 4096 ,...}) = 0 open ("/home/www/wms2. Xxx.com/protected/extensions/redis/XMRedis.php ", O_RDONLY) = 5 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2672 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2672 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2672 ,...}) = 0 fstat (5, {st_mode = S_IFREG | 0777, st_size = 2672 ,...}) = 0 mmap (NULL, 2672, PROT_READ, MAP_SHARED, 5, 0) = 0x7fd9b4804000 munmap (0x7fd9b4804000, 2672) = 0 close (5) = 0 sock Et (PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 5 close (5) = 0 socket (PF_INET, SOCK_STREAM, IPPROTO_IP) = 5 fcntl (5, F_GETFL) = 0x2 (flags O_RDWR) fcntl (5, F_SETFL, O_RDWR | O_NONBLOCK) = 0 connect (5, {sa_family = AF_INET, sin_port = htons (22122), sin_addr = inet_addr ("Hangzhou")}, 16) =-1 EINPROGRESS (Operation now in progress) poll ([{fd = 5, events = POLLIN | POLLOUT | POLLERR | POLLHUP}], 1, 3000) = 1 ([{fd = 5, reve ETS = POLLOUT}]) getsockopt (5, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 fcntl (5, F_SETFL, O_RDWR) = 0 setsockopt (5, SOL_TCP, TCP_NODELAY, [1], 4) = 0 poll ([{fd = 5, events = POLLIN | POLLPRI | POLLERR | POLLHUP}], 1, 0) = 0 (Timeout) sendto (5, "* 2 \ r \ n $4 \ r \ nAUTH \ r \ n $9 \ r \ nxm_wms_rs \ r \ n", 29, MSG_DONTWAIT, NULL, 0) = 29 poll ([{fd = 5, events = POLLIN | POLLPRI | POLLERR | POLLHUP}], 1, 0) = 0 (Timeout) poll ([{fd = 5, events = POLL IN | POLLERR | POLLHUP}], 1, 3000) = 1 ([{fd = 5, revents = POLLIN}]) recvfrom (5, "+ OK \ r \ n ", 8192, MSG_DONTWAIT, NULL, NULL) = 5 --- SIGSEGV (Segmentation fault) @ 0 (0) --- Process 6011 detached can be seen that after XMRedis is executed, Process 6011 will die. You can basically find that a problem occurs in php-redis. After tracing, a code error occurs: public function conn () {try {$ this-> _ redis-> pconnect ($ this-> host, $ this-> port, $ this-> timeout); // Set client option. must AFTER connected // var_dump (Redis: OPT_SERIALIZER, Redis: SERIALIZER_PHP); exit (); $ this-> _ redis-> setOption (Redis: OPT_SERIALIZER, Redis :: SERIALIZER_PHP); // $ this-> _ redis-> setOption (0, 0); $ this-> _ redis-> auth ("xm_wms_rs "); $ this-> connected = true;} catch (RedisE Xception $ e) {throw new CHttpException (500, "Redis occurs an error :". $ e-> getMessage ();} when the code in red is used, the error 502 will be reported, and the Green code is correct. SetOption: Is this a magic horse? Check php-redis api $ redis-> setOption (Redis: OPT_SERIALIZER, Redis: SERIALIZER_NONE ); // don't serialize data does not serialize data $ redis-> setOption (Redis: OPT_SERIALIZER, Redis: SERIALIZER_PHP ); // use built-in serialize/unserialize with php built-in serialization $ redis-> setOption (Redis: OPT_SERIALIZER, Redis: SERIALIZER_IGBINARY ); // use igBinary serialize/unserialize to serialize $ redis-> setOption (Redis: OPT_PREFIX, 'myappname: ') with extended IGBINARY :'); // Use custom prefix on all keys redis key prefix $ redis-> setOption (Redis: OPT_SERIALIZER, Redis: SERIALIZER_PHP ); if this is used, why does the built-in serialization of php cause an error? What happened? Later, the IGBINARY extension was installed. Finally, install php-redis with the latest version 2.24 and run it again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.