Jump to content

Does config.php cache?? Site is not using new database


shogun
 Share

Recommended Posts

I've updated the database info in the config.php, but I can tell on the site, it's not using the new one. Ive even completely deleted the database credentials in the config.php and the site is not affected.

Is there a config.php cache somewhere. I restarted the server also. Nothing. It's still using the old database.

Changing the database name here but the site is still using the old database on the backend.

$config->dbHost = 'localhost';
$config->dbName = 'dbname_new'; 
$config->dbUser = 'xxx';
$config->dbPass = 'xxx';
$config->dbPort = '3306';

 

Link to comment
Share on other sites

/site/config.php is not cached. Your site content may be, though, if you're using ProCache or something similar.

(Technically something else on the server could cache PHP files, but if a restart does nothing then this seems unlikely to be the issue here.)

I'd first check that this file is indeed the correct one: add something like a die() statement there, and if the site still runs as usual, either it's loaded from some sort of cache, or you're editing the wrong file.

Do other changes to e.g. template files have an effect on the site? And you are editing site/config.php, not wire/config.php?

Edit: If this is a dev environment, make sure that you don't have separate config-dev.php as well. Anyway, just throwing in wild guesses here ?

Link to comment
Share on other sites

This happened to me once when I moved a site to a new server and accidentally used details for remote access to the first server for dbHost. Took me a while to figure it out!

There can be various sorts of caching on the server, which may have been set up as a default by the hosting company without you being aware of it. They don't usually cause problems, but they might. What sort of server setup do you have?

Link to comment
Share on other sites

It's a lemp stack server so nginx.

I noticed when I went to the processwire dashboard later this evening it was reflecting the new database properly.

I was switching between a staging processwire dashboard and production process wire dashboard on the same server in my browser. Deleting pages in staging and it was happening on the production but I know for a fact their config files are different. 

But then later tonight the deleted pages didn't appear in my production admin dashboard which was correct.

Maybe the front end web page of my admins were being cached in between the two. I really don't know now what was going on. 

I'm going to try again tomorrow and see what happens. Strange.

Maybe the server was caching the dashboard. 

Link to comment
Share on other sites

Solution:

It wasn't a processwire issue. I found out my server does cache PHP files so any changes made on the server I need to clear cache afterwards. That's why my site/onfig.php never got updated!

NGINX server requires this for the cache clear:

sudo -S service php7.3-fpm reload 9>/tmp/fpmlock

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...