TomPich Posted November 10 Share Posted November 10 Hello guys, I have a strange and silent error on a PW website that I cannot figure out. It happens only online (not in local). It’s a database connexion error, and I never saw it on the website, it just appears in the logs. On localhost, the url is mfw-ut-inscription-2024. It’s a different one online, of course. I have my credentials for databases (internal and external databases) in config.php, which look like: // PW database if ( in_array($_SERVER["HTTP_HOST"], ["my-distant-website.com"])) { $config->dbName = 'xxx'; $config->dbUser = 'xxx'; $config->dbPass = 'xxx'; } else { $config->dbName = 'xxx'; $config->dbUser = 'root'; $config->dbPass = ''; } // External database if ( in_array($_SERVER["HTTP_HOST"], ["my-distant-website.com"])) { $config->gestiondbName = 'xxx'; $config->gestiondbUser = 'xxx'; $config->gestiondbPass = 'xxx'; } else { $config->gestiondbName = 'xxx'; $config->gestiondbUser = 'root'; $config->gestiondbPass = ''; } Everything works perfectly. But every day, I get new errors logged in the errors.txt log file (from the online website). 2024-11-10 12:41:56 ? https://mfw-ut-inscription-2024/ Error: Exception: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (in /home/joko4944/domains/staging.ut-inscription.com/wire/core/WireDatabasePDO.php line 505) #0 /home/joko4944/domains/staging.ut-inscription.com/wire/core/WireDatabasePDO.php(505): PDO->__construct() #1 /home/joko4944/domains/staging.ut-inscription.com/wire/core/WireDatabasePDO.php(872): ProcessWire\WireDatabasePDO->pdoWriter() #2 /home/joko4944/domains/staging.ut-inscription.com/wire/core/WireSaveableItems.php(219): ProcessWire\WireDatabasePDO->prepare() #3 /home/joko4944/domains/staging.ut-inscription.com/wire/core/Wire.php(416): ProcessWire\WireSaveableItems->___load() #4 /home/joko4944/domains/staging.ut-inscription.com/wire/core/WireHooks.php(968): ProcessWire\Wire->_callMethod() #5 /home/joko4944/domains/staging.ut-inscription.com/wire/core/Wire.php(484): ProcessWire\WireHooks->runHooks() #6 /home/joko4944/domains/staging.ut-inscription.com/wire/core/Fields.php(285): ProcessWire\Wire->__call() #7 /home/joko4944/domains/staging.ut-inscription.com/wire/core/Fields.php(172): ProcessWire\Fields->getWireArray() #8 /home/joko4944/domains/staging.ut-inscription.com/wire/core/ProcessWire.php(625): ProcessWire\Fields->init() #9 /home/joko4944/domains/staging.ut-inscription.com/wire/core/ProcessWire.php(578): ProcessWire\ProcessWire->initVar() #10 /home/joko4944/domains/staging.ut-inscription.com/wire/core/ProcessWire.php(315): ProcessWire\ProcessWire->load() #11 /home/joko4944/domains/staging.ut-inscription.com/index.php(52): ProcessWire\ProcessWire->__construct() #12 {main} So that’s very very strange because: (1) the url is *not* the url of the online website (although the errors only show up online). (2) at some point, PW tries to connect to my local databases (and of course it can’t, because it’s online) (3) I never noticed anything wrong on the onine website, nor my client... The local url (mfw-ut-inscription-2024) only appears at 4 places in the website files: Three times in config.php • $config->httpHosts = array('mfw-ut-inscription-2024', "my-distant-website.com"); • twice in something like: if ($_SERVER["HTTP_HOST"] === 'mfw-ut-inscription-2024' ){/* some scret keys for some services */} and one last time in a hook in init.php: $is_local = $this->config->domain === "mfw-ut-inscription-2024"; So I can’t understand how the online website can detect a session @ https://mfw-ut-inscription-2024/. Can this be due to some cache file? I only use the basic cache system of PW and no template is cached. Any clue or advice would be welcome. 😊 Thank you Link to comment Share on other sites More sharing options...
TomPich Posted November 11 Author Share Posted November 11 I think I got it. I use Stripe on this website. And to confirm webhook, there is a POST request sent by Strip to confirm payment. When I do a test on the local website, Stripe sends the request to the online website, but with a reference to the local url... So PW cache is not involved here, I guess... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now