公司行銷部門的同事前兩天突然敲我,問我說要怎麼在 WordPress 裝上 Jetpack 然後跟 wordpress.com 帳號做連結,原本心裡想說雖然沒裝過 Automattic 出品的 Jetpack,不過裝個 WordPress 插件好像也不會難倒我,自信的登入後臺之後才發現不是這麼一回事…。
看到行銷部門的同事已經把 Jetpack 裝好了,按下 連結 Jetpack
按鈕後,Jetpack 頁面出現了 錯誤詳細信息:
重點是:後面就沒有任何訊息了… ,後來上網找了一下資料,發現 Jetpack 有一個 debug 模式。
在 WordPress 網址後面加上:
wp-admin/admin.php?page=jetpack-debugger
There seems to be a problem with your site’s ability to communicate with Jetpack! It looks like your site can not communicate properly with Jetpack.
看到一堆錯誤訊息,找到一段可能比較像是錯誤提示的:
1 | [body] => {"error":"Can not resolve your domain \"A record\"","error_description":"We were unable to resolve the A record for your domain. It is likely that you have recently registered your domain name. It takes several hours for new or transferred domain names to start working, so please come check back later. If you're still having the same error after 48 hours, please contact your web hosting provider."} |
然後一直朝著 Can not resolve your domain A record
去找問題,發現網路上很多人問了同樣的問題,只是官方人員都建議點 support 回報問題 =口=
突然發現另外一條路,Jetpack 官方有提供一個 Debug 的網站
輸入網址後顯示:
1 | Debug XML-RPC is not responding correctly ( 500 ) |
在 Linux 下面輸入
1 | curl -A 'Jetpack by WordPress.com' -d '<methodCall><methodName>demo.sayHello</methodName></methodCall>' https://blog.***.com/xmlrpc.php |
發現回傳值是空白
加上 -is -H
看一下 Server 的回傳結果
1 | HTTP/1.1 500 Internal Server Error |
接著去翻一下 Nginx 的 error_log
,感覺發現曙光
1 | 2016/12/03 17:00:42 [error] 1126#1126: *10914 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function xml_parser_create() in /var/www/***/blog/wp-includes/class-IXR.php:264 |
其中的 Call to undefined function xml_parser_create() 感覺跟目的解答有 87% 像。
1 | sudo apt-get install php7.0-xml |
1 | sudo systemctl restart php7.0-fpm.service |
在用 curl 測試一次
1 | HTTP/1.1 200 OK |
進後臺錯誤訊息也不見了!
感覺被沒裝 PHP 套件雷了好多次,真的有點考慮
1 | sudo apt-get install php7.0-* |
1 | Need to get 55.0 MB of archives. |
好像也還可以接受(?)