워드프레스 모바일 로그인 오류 해결방법

Software · Posted on October 20, 2016 at 02:48 AM

워드프레스 모바일 로그인시에 간혹 아래와 같은 오류를 표출하며 로그인이 불가능할 때가 있다.

image002.png

워드프레스 (wordpress.com)의 블로그는 서버 설정이 되어있기에 문제가 없는데, 개인서버 (self-hosted website)는 서버 설정에 따라 위의 오류가 발생하는 경우가 종종 있다. 원인이 다양한데, 본 글에서는 PHP 버전에 따른 xml과 xmlrpc 모듈이 설치되지 않아 발생하는 원인에 대한 해결책을 소개한다.

원인 파악

아래는 WordPress for Android에서 출력한 application log 중 일부이다.

01 - WordPress.onCreate
02 - App comes from background
03 - ConnectionChangeReceiver.setEnabled true
04 - Connection status changed, isConnected=true
...
13 - No documented SNI support on Android <4.2, trying with reflection
14 - Established TLSv1.2 connection with www.cheonghyun.com using TLS_RSA_WITH_AES_128_CBC_SHA
15 - No HTTP error document document from the server
16 - system.listMethods failed on: https://www.cheonghyun.com/xmlrpc.php - exception: HTTP status code: 500 was returned. Internal Server Error
17 - StackTrace: org.xmlrpc.android.XMLRPCException: HTTP status code: 500 was returned. Internal Server Error
	at org.xmlrpc.android.XMLRPCClient$Caller.callXMLRPC(XMLRPCClient.java:547)
	at org.xmlrpc.android.XMLRPCClient$Caller.access$000(XMLRPCClient.java:430)
	at org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:231)
	at org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:226)
	at org.xmlrpc.android.XMLRPCUtils.doSystemListMethodsXMLRPC(XMLRPCUtils.java:96)
	at org.xmlrpc.android.XMLRPCUtils.checkXMLRPCEndpointValidity(XMLRPCUtils.java:203)
	at org.xmlrpc.android.XMLRPCUtils.verifyXmlrpcUrl(XMLRPCUtils.java:291)
	at org.xmlrpc.android.XMLRPCUtils.verifyOrDiscoverXmlRpcUrl(XMLRPCUtils.java:250)
	at org.wordpress.android.ui.accounts.helpers.FetchBlogListWPOrg$FetchBlogListTask.doInBackground(FetchBlogListWPOrg.java:55)
	at org.wordpress.android.ui.accounts.helpers.FetchBlogListWPOrg$FetchBlogListTask.doInBackground(FetchBlogListWPOrg.java:35)
	at android.os.AsyncTask$2.call(AsyncTask.java:287)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
	at java.util.concurrent.FutureTask.run(FutureTask.java:137)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
	at java.lang.Thread.run(Thread.java:856)
...
26 - The XML-RPC endpoint was not found by using our 'smart' cleaning approach. Time to start the Endpoint discovery process
27 - The app will call the RSD discovery process on the following URLs: [https://www.cheonghyun.com]
28 - Downloading the HTML content at the following URL: https://www.cheonghyun.com
29 - RSD endpoint found at the following address: https://www.cheonghyun.com/xmlrpc.php?rsd
30 - Downloading the RSD document...
31 - Extracting the XML-RPC Endpoint address from the RSD document
32 - Found the XML-RPC endpoint in the HTML document!!!
33 - Trying system.listMethods on the following URL: https://www.cheonghyun.com/xmlrpc.php
34 - No documented SNI support on Android <4.2, trying with reflection
35 - Established TLSv1.2 connection with www.cheonghyun.com using TLS_RSA_WITH_AES_128_CBC_SHA
36 - No HTTP error document document from the server
37 - system.listMethods failed on: https://www.cheonghyun.com/xmlrpc.php - exception: HTTP status code: 500 was returned. Internal Server Error
38 - StackTrace: org.xmlrpc.android.XMLRPCException: HTTP status code: 500 was returned. Internal Server Error
	at org.xmlrpc.android.XMLRPCClient$Caller.callXMLRPC(XMLRPCClient.java:547)
	at org.xmlrpc.android.XMLRPCClient$Caller.access$000(XMLRPCClient.java:430)
	at org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:231)
	at org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:226)
	at org.xmlrpc.android.XMLRPCUtils.doSystemListMethodsXMLRPC(XMLRPCUtils.java:96)
	at org.xmlrpc.android.XMLRPCUtils.checkXMLRPCEndpointValidity(XMLRPCUtils.java:203)
	at org.xmlrpc.android.XMLRPCUtils.discoverSelfHostedXmlrpcUrl(XMLRPCUtils.java:393)
	at org.xmlrpc.android.XMLRPCUtils.verifyOrDiscoverXmlRpcUrl(XMLRPCUtils.java:257)
	at org.wordpress.android.ui.accounts.helpers.FetchBlogListWPOrg$FetchBlogListTask.doInBackground(FetchBlogListWPOrg.java:55)
	at org.wordpress.android.ui.accounts.helpers.FetchBlogListWPOrg$FetchBlogListTask.doInBackground(FetchBlogListWPOrg.java:35)
	at android.os.AsyncTask$2.call(AsyncTask.java:287)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
	at java.util.concurrent.FutureTask.run(FutureTask.java:137)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
	at java.lang.Thread.run(Thread.java:856)
...

위 로그의 16번째줄, 26번째 줄을 확인해 보면, xmlrpc쪽에서 오류가 발생하는 것을 알 수 있다. 더 자세히 원인을 파악하기 위해, Apache Engine에서 출력한 error.log를 확인해 보았다. error.log는 우분투 기준 /var/log/apache2/error.log에서 확인할 수 있다.

[Sun Oct 16 23:29:00.403764 2016] [:error] [pid 2200] [client CLIENT_IP:PORT] PHP Fatal error:  Call to undefined function xml_parser_create() in /var/www/html_main/wp-includes/class-IXR.php on line 264
[Sun Oct 16 23:29:00.403882 2016] [:error] [pid 2200] [client CLIENT_IP:PORT] PHP Stack trace:
[Sun Oct 16 23:29:00.403896 2016] [:error] [pid 2200] [client CLIENT_IP:PORT] PHP   1. {main}() /var/www/html_main/xmlrpc.php:0
[Sun Oct 16 23:29:00.403913 2016] [:error] [pid 2200] [client CLIENT_IP:PORT] PHP   2. wp_xmlrpc_server->serve_request() /var/www/xmlrpc.php:84
[Sun Oct 16 23:29:00.403922 2016] [:error] [pid 2200] [client CLIENT_IP:PORT] PHP   3. IXR_Server->IXR_Server() /var/www/wp-includes/class-wp-xmlrpc-server.php:197
[Sun Oct 16 23:29:00.403930 2016] [:error] [pid 2200] [client CLIENT_IP:PORT] PHP   4. IXR_Server->__construct() /var/www/wp-includes/class-IXR.php:440
[Sun Oct 16 23:29:00.403938 2016] [:error] [pid 2200] [client CLIENT_IP:PORT] PHP   5. IXR_Server->serve() /var/www/wp-includes/class-IXR.php:432
[Sun Oct 16 23:29:00.403945 2016] [:error] [pid 2200] [client CLIENT_IP:PORT] PHP   6. IXR_Message->parse() /var/www/wp-includes/class-IXR.php:464

error.log 파일의 stack trace 를 보면, xmlrpc.php 에서 내부적으로 호출하는 함수에서 오류가 발생하는 것을 알 수 있다.

해결책

버전에 맞는 xml, xmlpc 모듈 설치

결론부터 말하자면, 필자는 버전에 맞는 php의 xml과 xmlrpc 모듈을 설치하여 해결하였다. 명령어는 아래와 같다.

sudo apt-get install php5.6-xml
sudo apt-get install php5.6-xmlrpc
sudo service apache2 restart

위 해결책은 현재 서버에서 사용하고 있는 php 버전과 .htaccess 설정에 따라 다르다. 이를 확인하기 위해서는, 현재 워드프레스가 설치되어 있는 디렉토리에 아래와 같은 코드를 적은 파일을 php 파일로 저장한 후 웹 서버에서 실행하면 된다.

<?php echo phpversion(); ?>

php 버전에 5.6이라면, 앞서 언급한 명령어를 사용하서 해결해 보길 바란다. (php -v 명령어를 통해서도 php 버전을 확인할 수 있으나, .htaccess 설정에 따라 실제 사용하는 엔진의 버전이 다를 수 있기에, php 파일을 간단하게 생성하여 확인하는 방법이 더 정확할 수 있다.)

xml, xmlrpc 재설치

이 항목부터는 다른 유저들이 해결책으로 제시한 것들을 정리하였다. 한 유저는 xml과 xmlrpc를 재설치하여 해결하였다고 한다 [1, 2]. 현재 php에서 사용중인 모듈을 php -m 명령어를 통해 확인한다.

[PHP Modules]
calendar
Core
ctype
date
...
tokenizer
wddx
xdebug
xml
xmlreader
xmlrpc
xmlwriter
zlib

xml과 xmlrpc 엔진이 목록에 없다면 설치되지 않은 것이니 아래 명령어로 설치한다.

sudo apt-get install php-xml
sudo apt-get install php-xmlrpc

혹시 이미 설치가 되어있는데도 문제가 발생하는 것이라면, 앞서 언급하였듯이 버전에 맞는 모듈을 설치하거나, 아래와 같이 삭제 후 재설치를 권장한다.

sudo apt-get purge php-xml
sudo apt-get purge php-xmlrpc

.htaccess 권한 및 엔진 버전 확인

간혹 .htaccess 에서 xmlrpc.php 파일에 직접 권한을 줘야 하는 경우가 있다 [3]. 본 글하고는 거리가 조금 있는 해결책인데, 해당 원인의 경우는 애초에 403 Forbidden 오류가 발생하였을 것이고, 오류 로그 자체도 다르게 출력되었을 것이다. .htaccess 파일에 아래와 같이 수정해 본다.

<Files xmlrpc.php>
    Order allow,deny
    Allow from all
</Files>

간혹 버전 문제인 경우도 있는데, 해당 폴더에 사용하는 php 버전 수정은 아래 명령어를 .htaccess 에 삽입하면 된다. (php 5.6 기준)

# Use PHP5.6 as default
AddHandler application/x-httpd-php56 .php

References

[1] Alexander, "Fixing Errors «Jetpack: site_inaccessible,» zakharovlx.com, 08-Apr-2016. [Online]. Available: https://zakharovlx.com/category/dev/wordpress/.
[2] http://tecfused.com/, "PHP Fatal error: Uncaught Error: Call to undefined function xml_parser_create()," tecfused.com, 08-Sep-2016. [Online]. Available: http://www.tecfused.com/2016/09/php-fatal-error-uncaught-error-call-undefined-function-xml_parser_create/.
[3] JigmeDatse, "[Resolved] The Jetpack server was unable to communicate with your site [HTTP 500]," WordPress.org, 22-Sep-2016. [Online]. Available: https://wordpress.org/support/topic/the-jetpack-server-was-unable-to-communicate-with-your-site-http-500/.

Posted by chlee

0 Comments

Post a comment

Security Code