1

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

4
  • Maybe the error was there all the time in the prior server/domain -- but the level of PHP error reporting is set differently now on the new server. Sometimes you have to decide if you are going to fight it or bury it...at least to get the site running so you can continue to debug elsewhere.
    – C C
    Feb 22, 2017 at 13:04
  • @CC Honestly, I just want to bury it. I can dig through, but I have no idea where to dig. Feb 22, 2017 at 15:13
  • Do a find in files in the entire directory for AUTOSAVE_INTERVAL, obviously something else is defining it. Also, comment out an essential constant like DB_NAME, see if the site is still working. It's possible that you are modifying the wrong wp-config.php file.
    – Fayaz
    Feb 22, 2017 at 16:52
  • @Fayaz Way ahead of you. The "find in files" was already done (last point in the list) and I even ran find ./ | grep wp-config and there's only 2. The other one is the sample. I've even traced the files, from the index.php to the wp-config.php. Feb 22, 2017 at 17:22

2 Answers 2

2

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.

7
  • They aren't. I tried that too. They are on line 90 and 91. But somehow the warning is on line 99 and 100. Feb 22, 2017 at 14:32
  • then most likely you are not looking at the right wp-config Feb 22, 2017 at 15:02
  • ... and my 4.7 mostly vanila wp-config end in line 89, so even 90 sounds wrong Feb 22, 2017 at 15:04
  • You can see my file on pastebin.com/HZhENpMu (in my defense, I didn't knew it is 100 lines long.). The lines 90 and 91 are commented, as you can see. Feb 22, 2017 at 15:37
  • that looks good, which brings back the options that this is not the correct file to look at. Are you sure there isn't for example a wp-config in the directory above? One simple way to verify is to add a die or introduce a syntax error at the file you are looking at now Feb 22, 2017 at 16:58
2

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!

8
  • 1
    Ha ha, yeah, if something happens so strange that it's not explainable at all, 99 times out of 100, it's some sort of cache :)
    – Fayaz
    Feb 22, 2017 at 17:54
  • @Fayaz Lesson learned. Only wasted around 9 hours with this :/ I really assumed there was no caching at all going on, since stuff changed sometimes... Oh, well, better luck for me next time. Feb 22, 2017 at 18:19
  • lol didn't even think about cache Feb 22, 2017 at 19:19
  • @MarkKaplun Me neither. I mean, I looked on PHP's side, but it was on Wordpress' side where the caching was :/ Feb 22, 2017 at 19:55
  • I hope you learned the lesson: Plugins should not handle caching, servers should ;) Better learn configuring a server for that task, then throwing an application on top. Bonus: You get more control plus much more caching power as requests that are available in cache never hit your PHP FPM or FCGI application server.
    – kaiser
    Mar 5, 2017 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.