Question

I've been tasked to move a website into a new domain, and I've encontered this weird issue.
On the homepage, I always see these:

Notice: Constant AUTOSAVE_INTERVAL already defined in /home/gturnat/public_html/wp-config.php on line 99

Notice: Constant WP_POST_REVISIONS already defined in /home/gturnat/public_html/wp-config.php on line 100


What I have tried:

  • Notice: Constant WP_POST_REVISIONS already defined suggests commenting the constants on default-constants.php, but it doesn't work.
  • Settings display_errors to 0, '0' or 'Off' does nothing.
  • Running error_reporting(0) will still display the errors.
  • Creating a mu-plugin (As suggested on How can I stop PHP notices from appearing in wordpress?).
    Nothing happens and the plugin isn't even loaded.
    The errors still keep showing up.
  • Tried to comment out the lines in wp-config.php, but didn't work. The notices are still there.
  • Removed the lines entirelly and moved them around wp-config.php, but the warnings insist it is on line 99 and 100.
    Causing a syntax error inside wp-config.php does lead to an error being logged, which means that the file isn't cached.
  • Tried to enable and disable the debug mode, set display_errors to false, 0, '0' and 'Off', but doesn't work.
  • Ran grep -1R WP_POST_REVISIONS * and grep -1R AUTOSAVE_INTERVAL * with the following result:

    root@webtest:# grep -lR WP_POST_REVISIONS *
    wp-config.php
    wp-includes/default-constants.php
    wp-includes/revision.php
    root@webtest:# grep -lR AUTOSAVE_INTERVAL *
    wp-config.php
    wp-includes/script-loader.php
    wp-includes/default-constants.php
    wp-includes/class-wp-customize-manager.php

I really am out of any other idea to try.


I'm using Wordpress 4.7.2, running on PHP 5.4 with the following modules loaded:

loaded modules

There is no op-cache working in the server. Just those options.

PHP was configured with the following options:

'./configure' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/opt/alt/php54' '--exec-prefix=/opt/alt/php54' '--bindir=/opt/alt/php54/usr/bin' '--sbindir=/opt/alt/php54/usr/sbin' '--sysconfdir=/opt/alt/php54/etc' '--datadir=/opt/alt/php54/usr/share' '--includedir=/opt/alt/php54/usr/include' '--libdir=/opt/alt/php54/usr/lib64' '--libexecdir=/opt/alt/php54/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/opt/alt/php54/usr/share/man' '--infodir=/opt/alt/php54/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/opt/alt/php54/etc' '--with-config-file-scan-dir=/opt/alt/php54/link/conf' '--with-exec-dir=/usr/bin' '--with-layout=GNU' '--disable-debug' '--disable-rpath' '--without-pear' '--without-gdbm' '--with-pic' '--with-zlib' '--with-bz2' '--with-gettext' '--with-gmp' '--with-iconv' '--with-openssl' '--with-kerberos' '--with-mhash' '--with-readline' '--with-pcre-regex=/opt/alt/pcre/usr' '--with-libxml-dir=/opt/alt/libxml2/usr' '--with-curl=/opt/alt/curlssl/usr' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-shmop' '--enable-calendar' '--enable-xml' '--enable-force-cgi-redirect' '--enable-fastcgi' '--enable-pcntl' '--enable-bcmath=shared' '--enable-dba=shared' '--with-db4=/usr' '--enable-dbx=shared,/usr' '--enable-dom=shared' '--enable-fileinfo=shared' '--enable-intl=shared' '--enable-json=shared' '--enable-mbstring=shared' '--enable-mbregex' '--enable-pdo=shared' '--enable-phar=shared' '--enable-posix=shared' '--enable-soap=shared' '--enable-sockets=shared' '--enable-sqlite3=shared,/opt/alt/sqlite/usr' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-sysvmsg=shared' '--enable-wddx=shared' '--enable-xmlreader=shared' '--enable-xmlwriter=shared' '--enable-zip=shared' '--with-gd=shared' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-t1lib=/opt/alt/t1lib/usr' '--with-imap=shared' '--with-imap-ssl' '--with-xmlrpc=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--enable-ucd-snmp-hack' '--with-xsl=shared,/usr' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared,/usr' '--with-pdo-sqlite=shared,/opt/alt/sqlite/usr' '--with-mssql=shared,/opt/alt/freetds/usr' '--with-interbase=shared,/usr' '--with-pdo-firebird=shared,/usr' '--with-pdo-dblib=shared,/opt/alt/freetds/usr' '--with-mcrypt=shared,/usr' '--with-tidy=shared,/usr' '--with-recode=shared,/usr' '--with-enchant=shared,/usr' '--with-pspell=shared' '--with-unixODBC=shared,/usr' '--with-icu-dir=/opt/alt/libicu/usr' '--with-sybase-ct=shared,/opt/alt/freetds/usr'

As a testing point, I tried to run it on PHP 5.6, with the same results, with the following modules:

php 5.6

Was it helpful?

Solution

tl;dr: Clear your (Comet) Cache!


Long answer:

I only have 2 words: Comet Cache!

Comet Cache was enabled.
Checking the source code showed me a note like this, after the closing </html>:

<!-- *´¨)
     ¸.•´¸.•*´¨) ¸.•*¨)
     (¸.•´ (¸.•` ¤ Comet Cache Notes ¤ ´¨) -->

<!-- Cache File Version Salt:       n/a -->

<!-- Cache File URL:                http://<my-domain> -->
<!-- Cache File Path:               /cache/comet-cache/cache/http/<my-domain>/index.html -->

<!-- Cache File Generated Via:      HTTP request -->
<!-- Cache File Generated On:       Feb 22nd, 2017 @ 5:37 pm UTC -->
<!-- Cache File Generated In:       4.59149 seconds -->

<!-- Cache File Expires On:         Mar 1st, 2017 @ 5:37 pm UTC -->
<!-- Cache File Auto-Rebuild On:    Mar 1st, 2017 @ 5:37 pm UTC -->

<!-- *´¨)
     ¸.•´¸.•*´¨) ¸.•*¨)
     (¸.•´ (¸.•` ¤ Comet Cache is Fully Functional ¤ ´¨) -->

<!-- Loaded via Cache On:    Feb 22nd, 2017 @ 5:37 pm UTC -->
<!-- Loaded via Cache In:    0.03472 seconds -->

Manually deleting /cache/comet-cache/cache/http/<my-domain>/index.html (path relative to your /wp-content/ directory) solved the issue.


I feel so stupid for assuming that there was no caching going on. Always blame the cache!

OTHER TIPS

If you do not have any plugin that manipulates those definitions, this is most likely cause by having the two constants defined below the line in the config.php that says

/* That's all, stop editing! Happy blogging. */

The relatively high line numbers support this idea.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top