|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
我的这套线路可能跟许多学习PHP的爱好者不谋而合,这也算是一个循序渐进的学习过程,不过新手不要看到上面的概括就以为学习蛮简单的,默默在此不得不对您稍微泼一下冷水,任何工具其实都不简单。比来因为update了ubuntu的源,招致本来新源与当地体系库一些lib抵触,招致体系桌面显现非常,厥后只要重装,新安装了php5.4.9,还安装了redis,php-redis扩大,php-redis扩大2,10。但把本来的项目一放上往,就报nginx502毛病(nginx502毛病真是个很头疼的成绩)。翻开nginx日记检察[error]29229#0:*1403recv()failed(104:Connectionresetbypeer)whilereadingresponseheaderfromupstream,client:127.0.0.1,server:不晓得所云。厥后翻开php-fpm毛病日记,失掉的log日记[08-Oct-201321:22:23]WARNING:[poolwww]child12026exitedonsignal11(SIGSEGV-coredumped)after5.997917secondsfromstart[08-Oct-201321:22:23]NOTICE:[poolwww]child12034started能够断定的一点,是php-fpm在一个工夫点后重启了一个历程。仍是毫无眉目。在网上搜了一年夜遍,有个有效的跟踪办法。1、设置php-fpm,只起一个work历程2、重启php-fpm,实行psauxgrepphp-fpm失掉work历程号pid3、strace-ppid上面是我失掉的信息getcwd("/home/www/wms2.xxxx.com",4096)=26lstat("/home/www/wms2.xiaomi.com/./RWebUser.php",0x7ffff4e30a10)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xiaomi.com/protected/vendor/wms/api/RWebUser.php",0x7ffff4e30a10)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xiaomi.com/protected/vendor/wms/RWebUser.php",0x7ffff4e30a10)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xiaomi.com/protected/extensions/log/RWebUser.php",0x7ffff4e30a10)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xiaomi.com/protected/modules/rights/components/RWebUser.php",{st_mode=S_IFREG0777,st_size=2945,...})=0lstat("/home/www/wms2.xiaomi.com/protected/modules/rights/components",{st_mode=S_IFDIR0777,st_size=4096,...})=0lstat("/home/www/wms2.xiaomi.com/protected/modules/rights",{st_mode=S_IFDIR0777,st_size=4096,...})=0lstat("/home/www/wms2.xiaomi.com/protected/modules",{st_mode=S_IFDIR0777,st_size=4096,...})=0open("/home/www/wms2.xiaomi.com/protected/modules/rights/components/RWebUser.php",O_RDONLY)=5fstat(5,{st_mode=S_IFREG0777,st_size=2945,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2945,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2945,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2945,...})=0mmap(NULL,2945,PROT_READ,MAP_SHARED,5,0)=0x7fd9b4804000mmap(NULL,266240,PROT_READPROT_WRITE,MAP_PRIVATEMAP_ANONYMOUS,-1,0)=0x7fd9b442f000munmap(0x7fd9b4804000,2945)=0close(5)=0getcwd("/home/www/wms2.xxx.com",4096)=26lstat("/home/www/wms2.xxx.com/./XMCCacheHttpSession.php",0x7ffff4e31060)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xxx.com/protected/vendor/wms/api/XMCCacheHttpSession.php",0x7ffff4e31060)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xxx.com/protected/vendor/wms/XMCCacheHttpSession.php",0x7ffff4e31060)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xxx.com/protected/extensions/log/XMCCacheHttpSession.php",0x7ffff4e31060)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xxx.com/protected/modules/rights/components/XMCCacheHttpSession.php",0x7ffff4e31060)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xxx.com/protected/modules/rights/XMCCacheHttpSession.php",0x7ffff4e31060)=-1ENOENT(Nosuchfileordirectory)lstat("/home/www/wms2.xxx.com/protected/components/XMCCacheHttpSession.php",{st_mode=S_IFREG0777,st_size=2612,...})=0open("/home/www/wms2.xxx.com/protected/components/XMCCacheHttpSession.php",O_RDONLY)=5fstat(5,{st_mode=S_IFREG0777,st_size=2612,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2612,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2612,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2612,...})=0mmap(NULL,2612,PROT_READ,MAP_SHARED,5,0)=0x7fd9b4804000munmap(0x7fd9b4804000,2612)=0close(5)=0sendto(4,"get6cacd9674ad21aa083b5032b1a29"...,39,MSG_DONTWAITMSG_NOSIGNAL,NULL,0)=39recvfrom(4,0x2806d88,8196,64,0,0)=-1EAGAIN(Resourcetemporarilyunavailable)poll([{fd=4,events=POLLIN}],1,5000)=1([{fd=4,revents=POLLIN}])recvfrom(4,"VALUE6cacd9674ad21aa083b5032b1a"...,8196,MSG_DONTWAIT,NULL,NULL)=128lstat("/home/www/wms2.xxx.com/yii/web/CHttpCookie.php",{st_mode=S_IFREG0777,st_size=2772,...})=0lstat("/home/www/wms2.xxx.com/yii/web",{st_mode=S_IFDIR0777,st_size=4096,...})=0open("/home/www/wms2.xxx.com/yii/web/CHttpCookie.php",O_RDONLY)=5fstat(5,{st_mode=S_IFREG0777,st_size=2772,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2772,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2772,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2772,...})=0mmap(NULL,2772,PROT_READ,MAP_SHARED,5,0)=0x7fd9b4804000munmap(0x7fd9b4804000,2772)=0close(5)=0stat("/home/www/wms2.xxx.com/protected/extensions/redis/XMRedis.php",{st_mode=S_IFREG0777,st_size=2672,...})=0lstat("/home/www/wms2.xxx.com/protected/extensions/redis/XMRedis.php",{st_mode=S_IFREG0777,st_size=2672,...})=0lstat("/home/www/wms2.xxx.com/protected/extensions/redis",{st_mode=S_IFDIR0777,st_size=4096,...})=0lstat("/home/www/wms2.xxx.com/protected/extensions",{st_mode=S_IFDIR0777,st_size=4096,...})=0open("/home/www/wms2.xxx.com/protected/extensions/redis/XMRedis.php",O_RDONLY)=5fstat(5,{st_mode=S_IFREG0777,st_size=2672,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2672,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2672,...})=0fstat(5,{st_mode=S_IFREG0777,st_size=2672,...})=0mmap(NULL,2672,PROT_READ,MAP_SHARED,5,0)=0x7fd9b4804000munmap(0x7fd9b4804000,2672)=0close(5)=0socket(PF_INET6,SOCK_DGRAM,IPPROTO_IP)=5close(5)=0socket(PF_INET,SOCK_STREAM,IPPROTO_IP)=5fcntl(5,F_GETFL)=0x2(flagsO_RDWR)fcntl(5,F_SETFL,O_RDWRO_NONBLOCK)=0connect(5,{sa_family=AF_INET,sin_port=htons(22122),sin_addr=inet_addr("10.237.36.231")},16)=-1EINPROGRESS(Operationnowinprogress)poll([{fd=5,events=POLLINPOLLOUTPOLLERRPOLLHUP}],1,3000)=1([{fd=5,revents=POLLOUT}])getsockopt(5,SOL_SOCKET,SO_ERROR,[0],[4])=0fcntl(5,F_SETFL,O_RDWR)=0setsockopt(5,SOL_TCP,TCP_NODELAY,[1],4)=0poll([{fd=5,events=POLLINPOLLPRIPOLLERRPOLLHUP}],1,0)=0(Timeout)sendto(5,"*2
$4
AUTH
$9
xm_wms_rs
",29,MSG_DONTWAIT,NULL,0)=29poll([{fd=5,events=POLLINPOLLPRIPOLLERRPOLLHUP}],1,0)=0(Timeout)poll([{fd=5,events=POLLINPOLLERRPOLLHUP}],1,3000)=1([{fd=5,revents=POLLIN}])recvfrom(5,"+OK
",8192,MSG_DONTWAIT,NULL,NULL)=5---SIGSEGV(Segmentationfault)@0(0)---Process6011detached能够看得出,在实行XMRedis落后程6011就逝世失落了。基础能够定位是php-redis出了成绩。持续清查终极发明了有段代码成绩publicfunctionconn(){try{$this->_redis->pconnect($this->host,$this->port,$this->timeout);//Setclientoption.mustAFTERconnected//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(RedisException$e){thrownewCHttpException(500,"Redisoccursanerror:".$e->getMessage());}}用白色的代码那段,就会报502毛病,而用绿色代码这段就没成绩。setOption这个是个神马器材呢?查了下php-redisapi$redis->setOption(Redis::OPT_SERIALIZER,Redis::SERIALIZER_NONE);//dontserializedata不序列化数据$redis->setOption(Redis::OPT_SERIALIZER,Redis::SERIALIZER_PHP);//usebuilt-inserialize/unserialize用php内置的序列化$redis->setOption(Redis::OPT_SERIALIZER,Redis::SERIALIZER_IGBINARY);//useigBinaryserialize/unserialize用扩大IGBINARY序列化$redis->setOption(Redis::OPT_PREFIX,myAppName:);//usecustomprefixonallkeysrediskey前缀$redis->setOption(Redis::OPT_SERIALIZER,Redis::SERIALIZER_PHP);用此就报502为何用php内置的序列化就会堕落呢?究竟产生了甚么?厥后又安装了IGBINARY扩大,仍是不可。最初把php-redis安装了最新的版本2.24,再运转,就完整没成绩了。如果不会怎么办,我的视频教程里有个最简单的留言板最开始离不开模仿, |
|