WordPress Critical Error
During WordPress installation, you might see an error like this:
There has been a critical error on your website.
You may enable the debug mode in wp-config.php to check the error.
[root@web ~]# vi /var/www/html/example/wp-config.php
...
define( 'WP_DEBUG', true );
There should be more debug information on your page. But if you were using Apache 2.4, you may check php-fpm's error log like this.
[root@web ~]# tail -f /var/log/php-fpm/www-error.log
...
[31-Dec-2019 05:36:35 UTC] PHP Fatal error: Uncaught Error: Call to undefined function json_encode() in /var/www/html/example/wp-includes/functions.php:3820
Stack trace:
#0 /var/www/html/example/wp-includes/widgets/class-wp-widget-text.php(58): wp_json_encode('text')
#1 /var/www/html/example/wp-includes/class-wp-widget.php(260): WP_Widget_Text->_register_one()
#2 /var/www/html/example/wp-includes/class-wp-widget-factory.php(112): WP_Widget->_register()
#3 /var/www/html/example/wp-includes/class-wp-hook.php(288): WP_Widget_Factory->_register_widgets('')
#4 /var/www/html/example/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters('', Array)
#5 /var/www/html/example/wp-includes/plugin.php(478): WP_Hook->do_action(Array)
#6 /var/www/html/example/wp-includes/widgets.php(1765): do_action('widgets_init')
#7 /var/www/html/example/wp-includes/class-wp-hook.php(288): wp_widgets_init('')
#8 /var/www/html/example/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array)
#9 /var/www/html/example/wp-includes/plugin.php(478): WP_Hook->do_action(A in /var/www/html/example/wp-includes/functions.php on line 3820
I know there could be other errors that I cannot cover them all in this post. In my case, it's a JSON problem. Let's check whether we have JSON module or not.
php-json
[root@web ~]# php -m | grep -i json
[root@web ~]#
There's none. Apparently, we don't have JSON module. Let's install it by this command.
[root@web ~]# yum -y install php-json
For Debian distros, you can use apt-get to install php-json.
Afterwards, you can refresh the page or go back to previous page to continue the installation. It should be no problem.
Occasionally, you might see the page like this:
You appear to have already installed WordPress. To reinstall please clear your old database tables first.
Log In
Since user's credentials were not properly saved in the previous step, so trying to log in your website cannot be done by this way. You have to do the following things:
- Clear all your tables
- Go back to installation page and click Run the Installation
- Fill user credentials and then submit the page
The URL might look like this:
The last successful page looks like this:
We did it.