[CWB] CRITICAL ERROR: $mysql_webuser has not been set in the configuration file.

Hardie, Andrew a.hardie at lancaster.ac.uk
Thu Mar 7 11:05:32 CET 2024


It looks like you at some point put the MySQL credentials into the $_SERVER array to avoid storing them in the config file -- using the non-stwqandard keys DATABASE_USERNAME etc. (Possibly this is done in your http daemon configuration? I don't know.)

But $_SERVER doesn't get these in the command line environment, so no offline script will work.

See https://www.php.net/manual/en/reserved.variables.server.php

Solution: insert the values directly into the config file instead of referencing $_SERVER.

best

Andrew.


-----Original Message-----
From: cwb-bounces at sslmit.unibo.it <cwb-bounces at sslmit.unibo.it> On Behalf Of Simon Meier-Vieracker
Sent: Thursday, March 7, 2024 8:20 AM
To: cwb at sslmit.unibo.it
Subject: [CWB] CRITICAL ERROR: $mysql_webuser has not been set in the configuration file.


Hi,

I was able to install a corpus in CQPweb v3.2.43 and to build the corpus frequency list within the menu „Manage frequency lists“.

However, when I tried to run the offline-freqlists.php script before, I got the error message attached below.

It has been some time since I have tried to install corpora and we rebuilt the directory structure on our server, so maybe some things got lost?

Indeed, the config.inc.php looks like this:

> /* -------------------------- *
>  * database connection config *
>  * -------------------------- */
>
> $mysql_webuser = $_SERVER['DATABASE_USERNAME'];
> $mysql_webpass = $_SERVER['DATABASE_PASSWORD'];
> $mysql_schema  = $_SERVER['DATABASE_NAME'];
> $mysql_server  = $_SERVER['DATABASE_HOSTNAME'];
>
> // clear sensitive values from environment
> unset(
>   $_SERVER['DATABASE_USERNAME'],
>   $_SERVER['DATABASE_PASSWORD'],
>   $_SERVER['DATABASE_NAME'],
>   $_SERVER['DATABASE_HOSTNAME']
> );
>
>
> /* ---------------------- *
>  * server directory paths *
>  * ---------------------- */
>
> $cqpweb_tempdir   = '/var/local/cqpweb/tmp';
> $cqpweb_uploaddir = '/var/local/cqpweb/upload';
> $cwb_datadir      = '/var/local/cqpweb/datafiles';
> $cwb_registry     = '/var/local/cqpweb/registry';

Any ideas what might have gone wrong and what I should check?

Best, Simon




> PHP Warning:  Undefined array key "DATABASE_USERNAME" in /var/www/tu-dresden_gsw_ali/cqpweb/lib/config.inc.php on line 21
> PHP Warning:  Undefined array key "DATABASE_PASSWORD" in /var/www/tu-dresden_gsw_ali/cqpweb/lib/config.inc.php on line 22
> PHP Warning:  Undefined array key "DATABASE_NAME" in /var/www/tu-dresden_gsw_ali/cqpweb/lib/config.inc.php on line 23
> PHP Warning:  Undefined array key "DATABASE_HOSTNAME" in /var/www/tu-dresden_gsw_ali/cqpweb/lib/config.inc.php on line 24
> <tr><td class="concorderror">
> <p class="errormessage">CRITICAL ERROR: $mysql_webuser has not been set in the configuration file.</p>
> </td></tr>
>
>               </table>
>
>
>       <hr>
>
>       <table class="concordtable fullwidth">
>               <tr>
>                       <td align="left" class="cqpweb_copynote" width="33%">
>                               CQPweb v3.2.43 &#169; 2008-2020
>                       </td>
>                       <td align="center" class="cqpweb_copynote" width="33%">
>                               <a class="cqpweb_copynote_link" href="help.php?ui=hello" target="cqpweb_help_browser">Help! on CQPweb</a>
>                       </td>
>                       <td align="right" class="cqpweb_copynote" width="33%">
>                               You are not logged in
>                       </td>
>               </tr>
>       </table>
>
>
>       <div id="templateForToolTip" class="floatingToolTip">
>               <table class="floatingToolTipFrame">
>                       <tr>
>                               <td class="floatingToolTipTarget">
>                                       &nbsp;
>                               </td>
>                       </tr>
>               </table>
>       </div>
>
>       </body>
>
> </html>
> PHP Warning:  Undefined property: stdClass::$Api in /var/www/tu-dresden_gsw_ali/cqpweb/lib/environment.php on line 1328
> PHP Fatal error:  Uncaught Error: Call to undefined method stdClass::disconnect_slave_program() in /var/www/tu-dresden_gsw_ali/cqpweb/lib/environment.php:1332
> Stack trace:
> #0 /var/www/tu-dresden_gsw_ali/cqpweb/lib/exiterror-lib.php(284): cqpweb_shutdown_environment()
> #1 /var/www/tu-dresden_gsw_ali/cqpweb/lib/environment.php(406): exiterror()
> #2 /var/www/tu-dresden_gsw_ali/cqpweb/lib/environment.php(1234): CQPwebEnvConfig->__construct()
> #3 /var/www/tu-dresden_gsw_ali/cqpweb/bin/offline-freqlists.php(97): cqpweb_startup_environment()
> #4 {main}
>   thrown in /var/www/tu-dresden_gsw_ali/cqpweb/lib/environment.php on line 1332


More information about the CWB mailing list