最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】调试微信接口出错:post data error,please check your server!

WeiXin crifan 7891浏览 0评论

【背景】

后来某次,再去测试自己的微信公众号,结果又失败:

微信公众号没有回复了:

didaosuzhou no reply when send text to weixin

然后去测试接口看看到底哪里出错了:

消息接口调试: 文本消息
请求地址:
http://xxx/php/wechat_encypt/wx_didaosuzhou_encrypt.php
成功或失败:
post data error,please check your server!  
错误原因:
http requset error 
状态码:
 
Headers:
 
解密前xml:
 
解密后xml:

 

【折腾过程】

1.然后去搜:

post data error,please check your server!

参考:

消息请求老是失败,感觉好像是没访问到post,有大神指点一下么?-CSDN论坛-CSDN.NET-中国最大的IT技术社区

另外,也去看了自己的服务器上面的php程序,对应log中,也的确没有任何输出:

可见,服务器本身对于所接收到的http请求就出错了,所以都没有后续的log。

2.然后再去访问服务器本身,好像无法访问:

firefox access webserver but no work

感觉像是服务器本身的Apache都没开?

去看了看,果然是:

服务器上面的web服务器Apache(的httpd的服务)都没有开:

root@chantyou:wechat_encypt# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.1.1503 (Core) 
Release:        7.1.1503
Codename:       Core
root@chantyou:wechat_encypt# service httpd status
Redirecting to /bin/systemctl status  httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
   Active: inactive (dead)

root@chantyou:wechat_encypt# systemctl status httpd
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
   Active: inactive (dead)

当然会导致微信出错了。。。

所以去开通:

root@chantyou:wechat_encypt# systemctl restart httpd
root@chantyou:wechat_encypt# systemctl status httpd 
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
   Active: active (running) since Sat 2015-07-25 15:46:17 CST; 2s ago
 Main PID: 1418 (httpd)
   Status: "Processing requests..."
   CGroup: /system.slice/httpd.service
           ├─1418 /usr/sbin/httpd -DFOREGROUND
           ├─1420 /usr/sbin/httpd -DFOREGROUND
           ├─1421 /usr/sbin/httpd -DFOREGROUND
           ├─1422 /usr/sbin/httpd -DFOREGROUND
           ├─1423 /usr/sbin/httpd -DFOREGROUND
           └─1424 /usr/sbin/httpd -DFOREGROUND

Jul 25 15:46:17 chantyou.com httpd[1418]: AH00548: NameVirtualHost has no effect and will be removed in the next release /e...conf:1
Jul 25 15:46:17 chantyou.com httpd[1418]: AH00558: httpd: Could not reliably determine the server's fully qualified domain ...essage
Jul 25 15:46:17 chantyou.com systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

然后再去微信接口测试,结果是:

然后就success,OK了:

after start apache then weixin api test success

然后实际测试,微信公众号也是可以正常回复了:

weixin public number can reply user normal

但是需要注意的是:

从手机端微信回复消息

微信回复用户

中间等了很长时间,有10多秒

感觉还是,用户体验很不好

 

暂时不清楚,是自己的服务器访问速度问题,还是微信端服务器有延迟

 

【总结】

当微信接口测试出现:

post data error,please check your server! 

的时候,要先去看看,自己的微信服务器是否正常运行。

此处是在CentOS 7中通过:

systemctl status httpd 

查看了apache2没有运行,然后去重新启动的:

systemctl restart httpd

即可。

转载请注明:在路上 » 【已解决】调试微信接口出错:post data error,please check your server!

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
84 queries in 0.184 seconds, using 22.05MB memory