• Hi,

    I recently:
    made FRESH install of WP, no plugins at all -> not plugin related
    Tried 6.x versions and 5.x versions -> no matter, so no WP version related

    BUT:
    All the time I get malformed JSON output, f.ex. leadin ‘0’ at the end of
    proper json -> got error because of the Zero added to the json by something.

    Site healt thingy says:

    REST API on yksi tapa, jolla WordPress ja muut sovellukset viestiv?t palvelimen kanssa. Yksi t?llainen esimerkki on lohkoeditori, joka tukeutuu siihen n?ytt??kseen ja tallentaakseen sivuja ja artikkeleita.
    
    Kutsu REST APIin antoi seuraavan odottamattoman tuloksen: (500) <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>500 Internal Server Error</title> </head><body> <h1>Internal Server Error</h1> <p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p> <p>Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.</p> <p>More information about this error may be available in the server error log.</p> <hr> <address>Apache/2.4.52 (Ubuntu) Server at paxsudos.fi Port 443</address> </body></html> .

    I wonder could it be my PHP installation (8.1, all modules installed) ..
    I’ve tried pretty much everything …

    
    Description:    Ubuntu 22.04.1 LTS
    Release:        22.04
    Codename:       jammy
    

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Wordpress continues to support PHP 8.1 only in the form of “beta support”. Thus, the cause of the problem may be the PHP version used. Change it to 8.0 or 7.4 and it should work.
    https://make.www.ads-software.com/core/handbook/references/php-compatibility-and-wordpress-versions/

    By the way, you should be able to see the specific error message caused by this in the error log of your hosting. There you should also see the actual reason, which is probably in a WordPress core file where a place is not PHP 8.1 compatible.

    Thread Starter miessuomesta

    (@miessuomesta)

    Thanks for reply @threadi .. I’ve now tried with PHP8.0 and with PHP7.4 (all modules installed: No working solution..

    With 7.4 i got, when trying to setup the initial config:
    [Sat Sep 03 18:18:06.934796 2022] [php7:notice] [pid 223418] [client 213.216.205.177:38594] PHP Fatal error: Uncaught Error: Call to undefined method wpdb::set_prefix() in /var/www/html/thesite.fi/wp-includes/load.php:620\nStack trace:\n#0 /var/www/html/thesite.fi/wp-settings.php(128): wp_set_wpdb_vars()\n#1 /var/www/html/thesite.fi/wp-admin/setup-config.php(33): require(‘/var/www/html/p…’)\n#2 {main}\n thrown in /var/www/html/thesite.fi/wp-includes/load.php on line 620

    Thread Starter miessuomesta

    (@miessuomesta)

    Now with debugs on, there’s now

    [03-Sep-2022 15:45:11 UTC] PHP 1. {main}() /var/www/html/thesite.fi/index.php:0 [03-Sep-2022 15:45:11 UTC] PHP 2. require() /var/www/html/thesite.fi/index.php:17 [03-Sep-2022 15:45:11 UTC] PHP 3. require_once() /var/www/html/thesite.fi/wp-blog-header.php:19 [03-Sep-2022 15:45:11 UTC] PHP 4. do_action($hook_name = 'template_redirect') /var/www/html/thesite.fi/wp-includes/template-loader.php:13 [03-Sep-2022 15:45:11 UTC] PHP 5. WP_Hook->do_action($args = [0 => '']) /var/www/html/thesite.fi/wp-includes/plugin.php:476 [03-Sep-2022 15:45:11 UTC] PHP 6. WP_Hook->apply_filters($value = '', $args = [0 => '']) /var/www/html/thesite.fi/wp-includes/class-wp-hook.php:331 [03-Sep-2022 15:45:11 UTC] PHP 7. call_user_func_array:{/var/www/html/thesite.fi/wp-includes/class-wp-hook.php:307}($callback = 'redirect_canonical', $args = [0 => '']) /var/www/html/thesite.fi/wp-includes/class-wp-hook.php:307 [03-Sep-2022 15:45:11 UTC] PHP 8. redirect_canonical($requested_url = '', $do_redirect = *uninitialized*) /var/www/html/thesite.fi/wp-includes/class-wp-hook.php:307 [03-Sep-2022 15:45:11 UTC] PHP 9. wp_redirect($location = 'https://thesite.fi/wp-json/wp/v2/taxonomies/?context=edit&per_page=100&_locale=user', $status = 301, $x_redirect_by = *uninitialized*) /var/www/html/thesite.fi/wp-includes/canonical.php:799 [03-Sep-2022 15:45:11 UTC] PHP 10. header($header = 'Location: https://thesite.fi/wp-json/wp/v2/taxonomies/?context=edit&per_page=100&_locale=user', $replace = TRUE, $response_code = 301) /var/www/html/thesite.fi/wp-includes/pluggable.php:1424

    Nothing more.

    Thread Starter miessuomesta

    (@miessuomesta)

    I checked the thesite.fi/wp-json/ and it fails to parse in browser?? Is that normal? There’s JSON (proper) and HTML after it..

    “Call to undefined method” sounds like an incomplete installation to me. There is probably at least one file missing or it is incompletely saved.

    The second error output means nothing to me. This is not an error but rather a description of the process.

    My recommendation: reinstall. Should be easy since it was a fresh installation anyway. Make sure you have enough free memory.

    Thread Starter miessuomesta

    (@miessuomesta)

    @threadi Hi, now i got PHP 8.1 + WP (no plugins) installed and the test: create blog entry goes smoothly .. something in ubuntu’s upgrade did mess that up

    now I put hold EVERYTHING ?? …

    Thread Starter miessuomesta

    (@miessuomesta)

    Theys packages i’ve put hold now:

    libc6 hold
    libxml2 hold
    libssl3 hold
    libpcre2-8-0 hold
    zlib1g hold
    libsodium23 hold
    libargon2-1 hold
    libc6 hold
    libicu70 hold
    liblzma5 hold
    libicu70 hold
    libstdc++6 hold
    libgcc-s1 hold

    feed the above to ‘dpkg –set-selections’ command as root

    Thread Starter miessuomesta

    (@miessuomesta)

    It seems that the openssl might be the cultpir. there has been some notably changes in it,and when it is updated the things goe woe.

    • This reply was modified 2 years, 2 months ago by miessuomesta.
    • This reply was modified 2 years, 2 months ago by miessuomesta.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘WP has malformed JSON’ is closed to new replies.