Jump to content

[RESOLVED] Why am I getting this error? "no site configuration or install.php available"


OrganizedFellow
 Share

Recommended Posts

Well, here's a new error!

I just moved from using OpenShift for my development to my new host (nearly free speech).

I had some errors getting my git repos working, but resolved those.

Now I've got this:

"404 page not found (no site configuration or install.php available)"

- Imported sql file.

- Inserted the correct info in config.php for the database.

- config.php is 644

- site/assets is 777

- site/cache , logs, and sessions are all empty.

Site in question is: http://www.modernexteriorsofelpaso.com/

Link to comment
Share on other sites

Try this...
 

A few things to check:

  • Check if there is a /site/assets/installed.php file. If there is, delete it. That file would only be present if your installation was copied from another, rather than from a fresh GitHub/zip file.
  • Double check that there is an /install.php file present.
  • If you still get an error, try accessing /install.php directly from your browser.

 
https://processwire.com/talk/topic/3256-db-connect-error-2005-before-installation/?p=32366

Link to comment
Share on other sites

That error occurs only if $config->dbName is undefined (from /site/config.php). Usually that's a signal for PW to load install.php (installer) but it was also not found. If you can look in /site/config.php and see that $config->dbName is defined and it's correct, then you'd want to 1) Make sure you don't have a /site/config-dev.php overriding your /site/config.php; and 2) look at whether something is fishy or non-standard with the server paths. The good news is that debugging it doesn't need to go beyond your /index.php because PW is basically not able to load beyond that… the error is coming directly from /index.php. 

  • Like 2
Link to comment
Share on other sites

Thank you for the suggestions Kongondo and Ryan.

I have step by step, done the above recommendations.

Starting with making sure I have the correct $config->dbName in my config.php file.

It is indeed correct. I like to use adminer instead of phpmyadmin, it's quicker. dbName is correct.

There's nothing fishy with server paths.

config.php is writeable (666)

Deleted /site/assets/installed.php (actually just renamed it to php.bak)

./install.php does exist and is browser accessible.

Just to be certain, I replaced ./index.php with a fresh copy from PW2.5 download.

Still the errors persists.

hhmm ... I'm scratching my bald head pretty harsh now. lol

Link to comment
Share on other sites

You actually do want /site/assets/installed.php to exist, and you don't need /install.php if this is an existing site.

Are you sure this server is Apache or 100% Apache compatible? Currently it sounds like it might not be. You'll also want to double check the PHP version. 

I would try renaming your .htaccess file to htaccess.txt temporarily to see if you get any change in the error message. 

Do you have an index.config.php (multi-site config file) file in your web root? (I'm assuming not, but just double checking since that adds new layers to the question).

If confirmed the server is Apache and PHP version is alright, I would next try looking at the $_SERVER variable. Specifically, paste this into a /oftest.php file and PM me the result: 

<pre><?php print_r($_SERVER); 
Link to comment
Share on other sites

HOLY SMOKES I FIXED IT!!!!!!!!!!

For the longest time I have used the following setup

$base_url  = $_SERVER['SERVER_NAME'];
switch ($base_url) {
	// LOCAL CONFIG
	case "mywebsite.dev":
		$config->dbHost    = 'localhost';
		$config->dbName    = 'database';
		$config->dbUser    = 'user';
		$config->dbPass    = 'pAsSwOrD';
		$config->dbPort    = '3306';
		$config->debug     = true; 
		$config->httpHosts = array('mywebsite.dev', 'www.mywebsite.dev');
		break;
	// LIVE CONFIG
	case "mywebsite.com":
		$config->dbHost = 'localhost';
		$config->dbName = 'database';
		$config->dbUser = 'user';
		$config->dbPass = 'PaSsWoRd';
		$config->dbPort    = '3306';
		$config->debug     = false; 
		$config->httpHosts = array('mywebsite.com', 'www.mywebsite.com');
		break;
}

I guess now that no longer works.

:(

@Ryan

At your mention above about config-dev.php, I decided to remove my switch statements from the config.php file and it works fine.

:)

GEEZZZ MAANNN it's always the simplest answer, isn't it?

:D

  • Like 1
Link to comment
Share on other sites

Glad you figured it out. Unfortunately $_SERVER['SERVER_NAME'] can't always be relied upon because some cases have it populated with something other than the hostname of the current site (like the hostname of the server itself rather than the site). Though you also can't rely on $_SERVER['HTTP_HOST'] either, as that can be manipulated by the request. If you need the capability to automatically switching DB configs depending on dev or live, your best bet is probably to copy your /site/config.php to /site/config-dev.php and only keep that file in your dev environment. Your /site/config.php will be ignored when /site/config-dev.php is present, enabling you to accomplish the same thing you are now, so long as you don't upload config-dev.php to your live site. 

  • Like 4
Link to comment
Share on other sites

... your best bet is probably to copy your /site/config.php to /site/config-dev.php and only keep that file in your dev environment. Your /site/config.php will be ignored when /site/config-dev.php is present, enabling you to accomplish the same thing you are now, so long as you don't upload config-dev.php to your live site.

oh. I did upload config-dev.php to my live site. It threw some amazing errors. But I fixed that rather quickly :)
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...