Re: PHP Warning: Constant MW_INSTALL_PATH already defined

MI <[email protected]> Wed, 12 Nov 2025 11:21:08 +0100
Newsgroups gmane.org.wikimedia.mediawiki
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============0085521249351011546==
Content-Type: multipart/alternative;
 boundary="------------m6VIoWGUl0Pme9Fr0MvfkvJX"
Content-Language: en-US, fr

This is a multi-part message in MIME format.
--------------m6VIoWGUl0Pme9Fr0MvfkvJX
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Indeed, the wiki actually works fine after simply removing the 
|define('MW_INSTALL_PATH'| line. And the |purgeList.php| command doesn't 
complain anymore.

Thank you!

MI

-------- Original Message -------- (Thomas Eugene Bishop, 11/11/2025 18.05)
> 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.”
>
> 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 AM, MI <[email protected]> wrote:
>>
>> Thanks. I had checked that, and it's not defined twice.
>>
>>
>> -------- 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’re seeing.
>>>
>>> Best regards,
>>> Zoran
>>>
>>> уто, 11. нов 2025. у 12:18 MI <[email protected]> је написао/ла:
>>>
>>>     Since I upgraded mediawiki from v. 1.35 to v. 1.39, I get this
>>>     error when running a script to purge the cache.
>>>
>>>     The command producing the error is
>>>
>>>         echo "Main_Page" | php /usr/share/mediawiki/maintenance/purgeList.php
>>>
>>>     The full error is
>>>
>>>         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:
>>>
>>>         # 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.
>>>
>>>     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)
>>>
>>>     Thanks,
>>>
>>>     MI
>>>
>>>
>>>     _______________________________________________
>>>     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/
>>>
>>>
>>> _______________________________________________
>>> MediaWiki-l mailing list [email protected]
>>> To unsubscribe send an email [email protected]
>>> https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
>> _______________________________________________
>> 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/
>
>
> Wenlin Institute, Inc. SPC (a Social Purpose Corporation)
> 文林研究所社会目的公司
> Software for Learning Chinese
> E-mail: [email protected]     Web: https://wenlin.com
> Telephone: 1-877-4-WENLIN (1-877-493-6546)
> ☯Unity in Diversity☮
>
>
>
> _______________________________________________
> MediaWiki-l mailing list [email protected]
> To unsubscribe send an email [email protected]
> https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/
--------------m6VIoWGUl0Pme9Fr0MvfkvJX
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Indeed, the wiki actually works fine after simply removing the <code>define('MW_INSTALL_PATH'</code>
      line. And the <code>purgeList.php</code> command doesn't complain
      anymore.</p>
    <p>Thank you!</p>
    <p>MI</p>
    <p></p>
    <div class="moz-cite-prefix">-------- Original Message --------
      (Thomas Eugene Bishop, 11/11/2025 18.05)<br>
    </div>
    <blockquote type="cite"
      cite="mid:[email protected]">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div>According to <a
          href="https://www.mediawiki.org/wiki/Manual:LocalSettings.php"
          moz-do-not-send="true" class="moz-txt-link-freetext">https://www.mediawiki.org/wiki/Manual:LocalSettings.php</a> ,
        "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.”</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="cite">
          <div>On Nov 11, 2025, at 7:22 AM, MI <a class="moz-txt-link-rfc2396E" href="mailto:[email protected]">&lt;[email protected]&gt;</a>
            wrote:</div>
          <br class="Apple-interchange-newline">
          <div>
            <meta http-equiv="Content-Type"
              content="text/html; charset=UTF-8">
            <div>
              <p>Thanks. I had checked that, and it's not defined twice.</p>
              <p><br>
              </p>
              <div class="moz-cite-prefix">-------- Original Message
                -------- (Zoran Dori, 11/11/2025 12.32)<br>
              </div>
              <blockquote type="cite"
cite="mid:CAOKmWLHmMCS=tjRVgRTWKUzhfHLX2Smh5w4eWJR3crJgz2ufPg@mail.gmail.com">
                <meta http-equiv="content-type"
                  content="text/html; charset=UTF-8">
                <div dir="ltr">Hello,<br>
                  I suggest checking if `MW_INSTALL_PATH` is defined
                  twice in your `LocalSettings.php`. This could be
                  causing the warning you’re seeing.
                  <div><br>
                  </div>
                  <div>Best regards,<br>
                    Zoran</div>
                </div>
                <br>
                <div class="gmail_quote gmail_quote_container">
                  <div dir="ltr" class="gmail_attr">уто, 11. нов 2025. у
                    12:18 MI &lt;<a href="mailto:[email protected]"
                      moz-do-not-send="true"
                      class="moz-txt-link-freetext">[email protected]</a>&gt;
                    је написао/ла:<br>
                  </div>
                  <blockquote class="gmail_quote"
style="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:  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="mailto:[email protected]"
                      target="_blank" moz-do-not-send="true"
                      class="moz-txt-link-freetext">[email protected]</a><br>
                    To unsubscribe send an email to <a
href="mailto:[email protected]" target="_blank"
                      moz-do-not-send="true"
                      class="moz-txt-link-freetext">[email protected]</a><br>
                    <a
href="https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/"
                      rel="noreferrer" target="_blank"
                      moz-do-not-send="true"
                      class="moz-txt-link-freetext">https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/</a></blockquote>
                </div>
                <br>
                <fieldset class="moz-mime-attachment-header"></fieldset>
                <pre class="moz-quote-pre" wrap="">_______________________________________________
MediaWiki-l mailing list -- <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
To unsubscribe send an email to <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/">https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/</a></pre>
              </blockquote>
            </div>
            _______________________________________________<br>
            MediaWiki-l mailing list -- <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a><br>
            To unsubscribe send an email to
            <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a><br>
<a class="moz-txt-link-freetext" href="https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/">https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/</a></div>
        </blockquote>
      </div>
      <br>
      <div>
        <meta charset="UTF-8">
        <div dir="auto"
style="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. SPC (a Social Purpose Corporation)<br>
          文林研究所社会目的公司<br>
          Software for Learning Chinese<br>
          E-mail: <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>     Web: <a
            href="https://wenlin.com" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://wenlin.com</a><br>
          Telephone: 1-877-4-WENLIN (1-877-493-6546)<br>
          ☯Unity in Diversity☮<br>
          <br>
        </div>
      </div>
      <br>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
MediaWiki-l mailing list -- <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
To unsubscribe send an email to <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/">https://lists.wikimedia.org/postorius/lists/mediawiki-l.lists.wikimedia.org/</a></pre>
    </blockquote>
  </body>
</html>

--------------m6VIoWGUl0Pme9Fr0MvfkvJX--

--===============0085521249351011546==
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/
--===============0085521249351011546==--