Monthly Archives: December 2019

Misconfiguration in DNS Forwarding which leads ERR_TOO_MANY_REDIRECTS

Today, I misconfigured DNS in GoDaddy Forwarding which caused this issue.

In GoDaddy, I’ve setup Forwarding to my IP 11.11.11.11(sample IP). Then in the host, I have wordpress with below config in wp-config.php:

define('WP_HOME', 'http://www.sample.com/');

define('WP_SITEURL',' http://www.sample.com/');

This means, my host will forward to www.sample.com. Then GoDaddy Forwarding setup will redirect to 11.11.11.11. Then wordpress on 11.11.11.11 will redirect to www.sample.com again and again. The fix is that I delete Forwarding in GoDaddy and add A Name. See my another post for how to add AName.

See how my chrome debugger looks. And finally it got ERR_TOO_MANY_REDIRECTS error when opening the page.

Category: web

Setup a DNS name on GoDaddy for your host

First of all, some name concepts:

A Name, mapping from alias to IP. For example: sample.com -> 11.11.11.11

CNAME, mappgin from alias to another alias. For example: www -> sample.com

Below is a GoDaddy DNS page. Assume I registered a sample.com dns name.

In the first row, it has type A ‘@‘ name. Put your hosting IP on this row.

Then there is Type CNAME ‘www‘ name. I put value ‘@‘. This means there is a alias www.sample.com which will forward to A name ‘@‘, then to the hosting IP.

go_daddy

Category: web

wordpress installation issues

Mysql connection issue. If there is always connection issue. Try update mysql password with mysql_native_password keyword.

ALTER USER root@localhost identified with mysql_native_password by 'your_password';

‘Invalid default value’ = database install fail error

It is because php is too strict to allow the script to run.
vim /etc/my.cnf

Add below:

[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION

Unable to install plugin. Add below into wp-config.php

define( 'FS_METHOD', 'direct' );

There might be plugin installation issue. So to me, just chmod 777 on wp-content folder:

chmod -R 777 wp-content

Other useful mysql command.

Completely delete wordpress tables

drop table wp_commentmeta, wp_options, wp_postmeta, wp_term_relationships, wp_term_taxonomy, wp_terms, wp_usermeta;
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'localhost';

Script testing mysql connection

<?php
            $mysqli = new mysqli('localhost', 'username', 'password', 'dbname');

    /* check connection */
if ($mysqli->connect_errno) {
        printf("Connect failed: %s\n", $mysqli->connect_error);
        exit();
    }

    /* check if server is alive */
if ($mysqli->ping()) {
        printf ("Our connection is ok!\n");
    } else {
        printf ("Error: %s\n", $mysqli->error);
    }

    /* close connection */
    $mysqli->close();
?>
Category: web