Re: PHP Warning: Constant MW_INSTALL_PATH already defined

Thomas Eugene Bishop <[email protected]> Tue, 11 Nov 2025 12:05:24 -0500
Newsgroups gmane.org.wikimedia.mediawiki
Message-ID <[email protected]>
--===============2187061552510454679==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_F4BFDCC1-0DFF-4915-B437-6FF9DFBB51AF"


--Apple-Mail=_F4BFDCC1-0DFF-4915-B437-6FF9DFBB51AF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

According to https://www.mediawiki.org/wiki/Manual:LocalSettings.php , =
"The $IP (install path) variable holds the local file path to the base =
installation of your wiki. Since MediaWiki 1.18, the system sets $IP =
automatically. Setting $IP manually in LocalSettings.php is no longer =
needed. $IP will default to the current working directory and can be =
used without the need to manually define it. Attempting to set $IP (or =
MW_INSTALL_PATH) in LocalSettings.php may produce unexpected results.=E2=80=
=9D

Maybe it would work simply to remove the line with MW_INSTALL_PATH from =
LocalSettings.php.

Good luck!

Tom

> On Nov 11, 2025, at 7:22=E2=80=AFAM, MI <[email protected]> wrote:
>=20
> Thanks. I had checked that, and it's not defined twice.
>=20
>=20
>=20
> -------- Original Message -------- (Zoran Dori, 11/11/2025 12.32)
>> Hello,
>> I suggest checking if `MW_INSTALL_PATH` is defined twice in your =
`LocalSettings.php`. This could be causing the warning you=E2=80=99re =
seeing.
>>=20
>> Best regards,
>> Zoran
>>=20
>> =D1=83=D1=82=D0=BE, 11. =D0=BD=D0=BE=D0=B2 2025. =D1=83 12:18 MI =
<[email protected] <mailto:[email protected]>> =D1=98=D0=B5 =
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BE/=D0=BB=D0=B0:
>>> Since I upgraded mediawiki from v. 1.35 to v. 1.39, I get this error =
when running a script to purge the cache.
>>>=20
>>> The command producing the error is
>>>=20
>>> echo "Main_Page" | php =
/usr/share/mediawiki/maintenance/purgeList.php
>>> The full error is
>>>=20
>>> PHP Warning:  Constant MW_INSTALL_PATH already defined in =
/etc/mediawiki/LocalSettings.php on line 25
>>> Indeed I have this on lines 21 to 25 in LocalSettings.php:
>>>=20
>>> # We define this to allow the configuration file to be explicitly.
>>> # located in /etc/mediawiki.
>>> # Change this if you are setting up multisite wikis on your server.
>>> define('MW_INSTALL_PATH','/docs/www-wiki');
>>> I had this through many MW versions over the years, and I don't =
think I can remove it.
>>>=20
>>> How can I get rid of this error? (The purge script runs every night =
from crontab, so I get a mail every day with this "error". And of course =
I don't want to just suppress any errors by redirecting stderr)
>>>=20
>>> Thanks,
>>>=20
>>> MI
>>>=20
>>>=20
>>> _______________________________________________
>>> MediaWiki-l mailing list -- [email protected] =
<mailto:[email protected]>
>>> To unsubscribe send an email to =
[email protected] =
<mailto:[email protected]>
>>> =
https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.or=
g/
>>=20
>>=20
>> _______________________________________________
>> MediaWiki-l mailing list -- [email protected] =
<mailto:[email protected]>
>> To unsubscribe send an email to [email protected] =
<mailto:[email protected]>
>> =
https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.or=
g/
> _______________________________________________
> MediaWiki-l mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> =
https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.or=
g/


Wenlin Institute, Inc. SPC (a Social Purpose Corporation)
=E6=96=87=E6=9E=97=E7=A0=94=E7=A9=B6=E6=89=80=E7=A4=BE=E4=BC=9A=E7=9B=AE=E7=
=9A=84=E5=85=AC=E5=8F=B8
Software for Learning Chinese
E-mail: [email protected]     Web: https://wenlin.com =
<https://wenlin.com/>
Telephone: 1-877-4-WENLIN (1-877-493-6546)
=E2=98=AFUnity in Diversity=E2=98=AE



--Apple-Mail=_F4BFDCC1-0DFF-4915-B437-6FF9DFBB51AF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;"><div>According =
to&nbsp;<a =
href=3D"https://www.mediawiki.org/wiki/Manual:LocalSettings.php">https://w=
ww.mediawiki.org/wiki/Manual:LocalSettings.php</a>&nbsp;, "The $IP =
(install path) variable holds the local file path to the base =
installation of your wiki. Since MediaWiki 1.18, the system sets $IP =
automatically. Setting $IP manually in LocalSettings.php is no longer =
needed. $IP will default to the current working directory and can be =
used without the need to manually define it. Attempting to set $IP (or =
MW_INSTALL_PATH) in LocalSettings.php may produce unexpected =
results.=E2=80=9D</div><div><br></div><div>Maybe it would work simply to =
remove the line with MW_INSTALL_PATH from =
LocalSettings.php.</div><div><br></div><div>Good =
luck!</div><div><br></div><div>Tom</div><div><br><blockquote =
type=3D"cite"><div>On Nov 11, 2025, at 7:22=E2=80=AFAM, MI =
&lt;[email protected]&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div>

 =20
    <meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3DUTF-8">
 =20
  <div><p>Thanks. I had checked that, and it's not defined =
twice.</p><p><br>
    </p>
    <div class=3D"moz-cite-prefix">-------- Original Message --------
      (Zoran Dori, 11/11/2025 12.32)<br>
    </div>
    <blockquote type=3D"cite" =
cite=3D"mid:[email protected]=
il.com">
      <meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3DUTF-8">
      <div dir=3D"ltr">Hello,<br>
        I suggest checking if `MW_INSTALL_PATH` is defined twice in your
        `LocalSettings.php`. This could be causing the warning you=E2=80=99=
re
        seeing.
        <div><br>
        </div>
        <div>Best regards,<br>
          Zoran</div>
      </div>
      <br>
      <div class=3D"gmail_quote gmail_quote_container">
        <div dir=3D"ltr" class=3D"gmail_attr">=D1=83=D1=82=D0=BE, 11. =
=D0=BD=D0=BE=D0=B2 2025. =D1=83 12:18 MI
          &lt;<a href=3D"mailto:[email protected]" moz-do-not-send=3D"true"=
 class=3D"moz-txt-link-freetext">[email protected]</a>&gt; =D1=98=D0=B5
          =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BE/=D0=BB=D0=B0:<br>
        </div>
        <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div><p>Since I upgraded mediawiki from v. 1.35 to v. 1.39, I =
get
              this error when running a script to purge the =
cache.</p><p>The command producing the error is</p>
            <blockquote>
              <pre>echo "Main_Page" | php =
/usr/share/mediawiki/maintenance/purgeList.php</pre>
            </blockquote><p>The full error is<br>
            </p>
            <blockquote>
              <pre>PHP Warning:&nbsp; Constant MW_INSTALL_PATH already =
defined in /etc/mediawiki/LocalSettings.php on line 25
</pre>
            </blockquote><p>Indeed I have this on lines 21 to 25 in
              LocalSettings.php:</p>
            <blockquote>
              <pre># We define this to allow the configuration file to =
be explicitly.
# located in /etc/mediawiki.
# Change this if you are setting up multisite wikis on your server.
define('MW_INSTALL_PATH','/docs/www-wiki');
</pre>
            </blockquote><p>I had this through many MW versions over the =
years, and I
              don't think I can remove it.</p><p>How can I get rid of =
this error? (The purge script runs
              every night from crontab, so I get a mail every day with
              this "error". And of course I don't want to just suppress
              any errors by redirecting =
stderr)</p><p>Thanks,</p><p>MI<br>
            </p>
            <br>
          </div>
          _______________________________________________<br>
          MediaWiki-l mailing list -- <a =
href=3D"mailto:[email protected]" target=3D"_blank" =
moz-do-not-send=3D"true" =
class=3D"moz-txt-link-freetext">[email protected]</a><br>
          To unsubscribe send an email to <a =
href=3D"mailto:[email protected]" target=3D"_blank" =
moz-do-not-send=3D"true" =
class=3D"moz-txt-link-freetext">[email protected]</a><=
br>
          <a =
href=3D"https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wiki=
media.org/" rel=3D"noreferrer" target=3D"_blank" moz-do-not-send=3D"true" =
class=3D"moz-txt-link-freetext">https://lists.wikimedia.org/postorius/list=
s/mediawiki-l.lists.wikimedia.org/</a></blockquote>
      </div>
      <br>
      <fieldset class=3D"moz-mime-attachment-header"></fieldset>
      <pre class=3D"moz-quote-pre" =
wrap=3D"">_______________________________________________
MediaWiki-l mailing list -- <a class=3D"moz-txt-link-abbreviated" =
href=3D"mailto:[email protected]">[email protected]=
a.org</a>
To unsubscribe send an email to <a class=3D"moz-txt-link-abbreviated" =
href=3D"mailto:[email protected]">mediawiki-l-leave@li=
sts.wikimedia.org</a>
<a class=3D"moz-txt-link-freetext" =
href=3D"https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wiki=
media.org/">https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.=
wikimedia.org/</a></pre>
    </blockquote>
  </div>

_______________________________________________<br>MediaWiki-l mailing =
list -- [email protected]<br>To unsubscribe send an email =
to =
[email protected]<br>https://lists.wikimedia.org/posto=
rius/lists/mediawiki-l.lists.wikimedia.org/</div></blockquote></div><br><d=
iv>
<meta charset=3D"UTF-8"><div dir=3D"auto" style=3D"caret-color: rgb(0, =
0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: =
after-white-space;"><br>Wenlin Institute, Inc.&nbsp;SPC (a Social =
Purpose&nbsp;Corporation)<br>=E6=96=87=E6=9E=97=E7=A0=94=E7=A9=B6=E6=89=80=
=E7=A4=BE=E4=BC=9A=E7=9B=AE=E7=9A=84=E5=85=AC=E5=8F=B8<br>Software for =
Learning&nbsp;Chinese<br>E-mail: [email protected]&nbsp; &nbsp; =
&nbsp;Web:&nbsp;<a =
href=3D"https://wenlin.com">https://wenlin.com</a><br>Telephone: =
1-877-4-WENLIN&nbsp;(1-877-493-6546)<br>=E2=98=AFUnity in =
Diversity=E2=98=AE<br><br></div>
</div>
<br></body></html>=

--Apple-Mail=_F4BFDCC1-0DFF-4915-B437-6FF9DFBB51AF--

--===============2187061552510454679==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
MediaWiki-l mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
--===============2187061552510454679==--