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

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?

5
задан 5 January 2017 в 11:57
1 ответ

Похоже, что расширения php-xml и php-xmlrpc не установлены.

Установите их с помощью:

apt-get install php-xml php-xmlrpc

или ( CentOS, RHEL и т. Д.)

yum install php-xml php-xmlrpc
8
ответ дан 3 December 2019 в 01:17

Теги

Похожие вопросы