Migrating WP blog to my VM. New install of WordPress. Test posts with Guttenberg (Block) Editor. Following error:
Publishing failed. Error message: The response is not a valid JSON response.
An interesting rabbit hole. Lots of searches rightly suggested that using the classic editor would get round the problem. Or that by changing the permalinks settings to Plain would fix it. It did, but not much help if you want your permalink settings set to something else.
Eventually I discovered that the issue for me was with the .htaccess file not being processed, which was fixed by adding something along the lines of
<Directory /var/www/html> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
/etc/apache2/apache2.conf file (on Debian Buster). This worked for me, but I get the impression it’s better practice to edit the files in
/etc/apache2/sites-available instead for any local code in case
apache2.conf gets overwritten on an upgrade. Probably also need to do a:
a2enmod rewrite systemctl restart apache2
So for me the cause of the error message was quite obscure. Useful link: