大网数据广告活动
服务器运维问答

Wordpress, nginx, php-fpm: XML-RPC not working

· 52CE 我爱测

I've installed Wordpress with Nginx and PHP-FPM on my own server at https://saskia.photo The installation works great but the XML-RPC (used by Jetpack and the phone apps) throws the following error: <?xml version="1.0" encoding="…

问题原文

原帖链接 · Leonard Ehrenfried · CC BY-SA 3.0

I've installed Wordpress with Nginx and PHP-FPM on my own server at https://saskia.photo

The installation works great but the XML-RPC (used by Jetpack and the phone apps) throws the following error:

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
  <fault>
    <value>
      <struct>
        <member>
          <name>faultCode</name>
          <value><int>-32700</int></value>
        </member>
        <member>
          <name>faultString</name>
          <value><string>parse error. not well formed</string></value>
        </member>
      </struct>
    </value>
  </fault>
</methodResponse>

You can see the error yourself by running

curl -A "Jetpack by WordPress.com" -is -H 'Content-Type: text/xml' --data '<?xml version="1.0"?><methodCall><methodName>demo.sayHello</methodName><params></params></methodCall>' 'https://saskia.photo/xmlrpc.php' && echo

I've worked through Jetpack's troubleshooting page but no luck.

The XML error returned leads me to speculate that the client request XML is being corrupted somewhere between nginx and PHP so that it cannot be parsed.

Here is my nginx config file

server {
  listen      80;
  listen      [::]:80;
  server_name saskia.photo;
  rewrite     ^   https://$server_name$request_uri? permanent;
}

server {
  listen                443 ssl http2;
  listen                [::]:443 ssl http2;
  server_name           saskia.photo;
  ssl_certificate       /etc/letsencrypt/live/saskia.photo/fullchain.pem;
  ssl_certificate_key   /etc/letsencrypt/live/saskia.photo/privkey.pem;

  root                  /srv/wordpress/;
  charset               utf-8;

  client_max_body_size 64M;

  # Deny access to any files with a .php extension in the uploads directory
  location ~* /(?:uploads|files)/.*\.php$ {
    deny all;
  }

  location / {
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
  }

  location ~* \.(gif|jpg|jpeg|png|css|js)$ {
    expires max;
  }

  location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    fastcgi_pass  unix:/var/run/php/wordpress.sock;
    fastcgi_param   SCRIPT_FILENAME
      $document_root$fastcgi_script_name;
    include       fastcgi_params;
  }
}

Has anybody seen a problem like this or can spot a problem in my config files?

已采纳解答

原帖链接 · Orphans · CC BY-SA 4.0

It seems like the extensions php-xml and php-xmlrpc are not installed.

Install them with:

apt-get install php-xml php-xmlrpc

or (CentOS, RHEL etc..)

yum install php-xml php-xmlrpc

SuSE

zypper install php-xml php-xmlrpc

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-01-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。