admin管理员组文章数量:1318996
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
to0
,'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 insidewp-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
tofalse
,0
,'0'
and'Off'
, but doesn't work. - Ran
grep -1R WP_POST_REVISIONS *
andgrep -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:
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:
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
to0
,'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 insidewp-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
tofalse
,0
,'0'
and'Off'
, but doesn't work. - Ran
grep -1R WP_POST_REVISIONS *
andgrep -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:
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:
Share Improve this question edited Sep 9, 2020 at 22:56 Jesse Nickles 7357 silver badges19 bronze badges asked Feb 22, 2017 at 12:29 Ismael MiguelIsmael Miguel 1311 gold badge1 silver badge8 bronze badges 4 |2 Answers
Reset to default 2If 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.
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!
本文标签: errorsNotice Constant already defined in wpconfigphp on (nonexistent) line
版权声明:本文标题:errors - Notice: Constant already defined in wp-config.php on (non-existent) line? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742053670a2418178.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
find in files
in the entire directory forAUTOSAVE_INTERVAL
, obviously something else is defining it. Also, comment out an essential constant likeDB_NAME
, see if the site is still working. It's possible that you are modifying the wrongwp-config.php
file. – Fayaz Commented Feb 22, 2017 at 16:52find ./ | grep wp-config
and there's only 2. The other one is the sample. I've even traced the files, from theindex.php
to thewp-config.php
. – Ismael Miguel Commented Feb 22, 2017 at 17:22