[SOLVED] "can't establish a connection to the server...

Please post all install related problems here. Visit this forum first for troubleshooting.
mr_nabo
Posts: 11
Joined: Thu 30. Aug 2007, 02:09

[SOLVED] "can't establish a connection to the server...

Post by mr_nabo »

Hi,

trying to do a local install so I can develop my site then install and import my mysql data later. However, I can see the frontend but cannot get through to the admin end of things.

As it seems to be to do with connecting to localhost, I'm assuming it is something to do with a setting in the config file.

Can anyone help me solve this one?

Thanks
Last edited by mr_nabo on Thu 30. Aug 2007, 20:01, edited 2 times in total.
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

If you can see the frontend... then it must be connecting to localhost just fine... that's the local "friendly name" for IP address 127.0.0.1 that your Apache is serving up the page to. (ie. same as http://127.0.0.1/phpwcms_directory/index.php)

What exactly DOES happen when you go to "login.php" instead of "index.php" ? Does login just return to the same screen? Do you get an error message? Does it not paint the login screen (or can't it find it)?
mr_nabo
Posts: 11
Joined: Thu 30. Aug 2007, 02:09

Post by mr_nabo »

Thanks for getting back to me Dexxus.

When I go to the login.php page, I see the usual form asking for login data. I enter the correct username and password I created during my installation and then I can't go any further. I receive the message:

"Unable to connect

Firefox can't establish a connection to the server at localhost.

* The site could be temporarily unavailable or too busy. Try again in a few moments.

* If you are unable to load any pages, check your computer's network
connection... etc."

Any ideas?
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

Okay... that looks like how Firefox generically responds to not being able to connect. Check to make sure your MySQL installation's path/username/pass are correct by browsing to the path that you have set in "conf.inc.php" and then entering your MySQL username/password. See if it lets you log into MySQL (NOT using your phpWCMS user/pass).
mr_nabo
Posts: 11
Joined: Thu 30. Aug 2007, 02:09

Post by mr_nabo »

I assume it's not to do with the MySQL settings because I can see the frontend fine.

However, the paths may be wrong... If you have time, take a look at the below please. I installed phpwcms into a folder in the root (called 'phpwcms_1.3.3'). Do I need to change the DOC_ROOT path?:

Code: Select all

// paths
$phpwcms['DOC_ROOT']          = $_SERVER['DOCUMENT_ROOT'];// real DOC_ROOT seems to be: '/Applications/MAMP/htdocs//inc' 
$phpwcms['root']         		= 'phpwcms_1.3.3';         //default: ''
$phpwcms['file_path']         = 'filearchive';    //default: 'filearchive'
$phpwcms['templates']         = 'template';    //default: 'template'
$phpwcms['content_path']      = 'content'; //default: 'content'
$phpwcms['cimage_path']       = 'images';  //default: 'images'
$phpwcms['ftp_path']          = 'upload';     //default: 'upload'
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

Your problem is that phpWCMS has to open the MySQL database when you try to login to the CMS in order to authorize you and set up for any content you might add/change. Even though the path to your database is right...it looks like the MySQL username or password for your databse is not allowing access. If those other paths were wrong...you probably wouldn't see your frontend or at the least you'd have errors. Did you log in to MySQL like I asked (using the values you have stored in your "conf.inc.php")? You should confirm this! :wink:
mr_nabo
Posts: 11
Joined: Thu 30. Aug 2007, 02:09

Post by mr_nabo »

I thought I knew what to do, then realised I really don't! Should I be changing the //site values 'site' and 'admin_name' etc. details or are you talking about another path within the config file?

Sorry for being dumb on this one...
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

No problem (although i gotta run in a minute) I mean these:

Code: Select all

// database values
$phpwcms['db_host']           = 'localhost';
$phpwcms['db_user']           = '';
$phpwcms['db_pass']           = '';
$phpwcms['db_table']          = '';
$phpwcms['db_prepend']        = '';
$phpwcms['db_pers']           = 1;
$phpwcms['db_charset']        = 'utf8';
$phpwcms['db_collation']      = 'utf8_general_ci';
$phpwcms['db_version']        = 0;
If all fails, see if you can edit your PHP installation's "php.ini" file and set error_reporting line to temporarily show all errors.

SORRY to bug out on ya... but I can't continue right now...Keep chugging... somebody else will pick up where I left you hanging. :oops:
mr_nabo
Posts: 11
Joined: Thu 30. Aug 2007, 02:09

Post by mr_nabo »

That's great Dexxus, thanks for your help. I'll give your advice a shot and call it a day if it doesn't work as it's late here in the UK.

Cheers
mr_nabo
Posts: 11
Joined: Thu 30. Aug 2007, 02:09

Post by mr_nabo »

Ok, a quick look at the PHP log and I think I know what's going on, just don't know what to do about it. If anyone can help me where Dexxus left off, I'd be very appreciative. Here's the common log error:

Code: Select all

[30-Aug-2007 02:38:32] PHP Fatal error:  require() [<a href='function.require'>function.require</a>]: Failed opening required '/Applications/MAMP/htdocs/include/inc_ext/Openads/Openads_function.php' (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Applications/MAMP/htdocs/phpwcms_1.3.3/include/inc_lib/default.inc.php on line 66
That suggests to me that I need to change the path somewhere in the config.inc.php file so that my phpwcms installation reads from the 'phpwcms_1.3.3' folder that is found in my root folder.

Anybody help me out on what I should do next?

Thanks
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Not sure if I could add anything over what DeXXus suggested:

Code: Select all

$phpwcms['db_user']           = '';
$phpwcms['db_pass']           = '';
$phpwcms['db_table']          = '';


hmm... anyhow, I suppose/presume you are trying to browse your site
with this default Apache MAMP port :
http://localhost:8888

aren't you ?

Cheers,

Yves
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
mr_nabo
Posts: 11
Joined: Thu 30. Aug 2007, 02:09

Post by mr_nabo »

Hi Yves,

Yes, I'm trying to access the admin end of my site at 'http://localhost:8888/phpwcms_1.3.3/login.php' and frontend at 'http://localhost:8888/phpwcms_1.3.3/index.php'.
Even though the path to your database is right...it looks like the MySQL username or password for your databse is not allowing access. If those other paths were wrong...you probably wouldn't see your frontend or at the least you'd have errors.
True, changing the '//paths' value leaves the whole site unreachable.
Check to make sure your MySQL installation's path/username/pass are correct by browsing to the path that you have set in "conf.inc.php" and then entering your MySQL username/password. See if it lets you log into MySQL (NOT using your phpWCMS user/pass).
This is the part I'm having trouble with understanding. I can't see a path in the below that I can use to then try my MySQL details with. The only path I have set has been the ['DOC_ROOT'] and ['site'] entries in config.inc.php during the installation process.

Here are the details I have for '//database values' (password and user omitted obviously):

Code: Select all

//database values

$phpwcms['db_host']           = 'localhost';
$phpwcms['db_user']           = 'db_user_name';
$phpwcms['db_pass']           = 'db_password';
$phpwcms['db_table']          = 'phpwcms';
$phpwcms['db_prepend']        = '';
$phpwcms['db_pers']           = 1;
$phpwcms['db_charset']        = 'utf8';
$phpwcms['db_collation']      = 'utf8_general_ci';
$phpwcms['db_version']        = 50019;
Don't know what to do apart from uninstall and start again...
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Hi again Mr Nabo,
The only thing that I can think of checking again, would be
this line in your config file:

Code: Select all

$phpwcms['site']              = 'http://localhost:8888/';
Are set like this ?

Cheers,

Yves
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

StudioZ wrote:Hi again Mr Nabo,
The only thing that I can think of checking again, would be
this line in your config file:

Code: Select all

$phpwcms['site']              = 'http://localhost:8888/';
Are set like this ?

Cheers,

Yves
Yves makes sense...since you show the presumed correct entries for $phpwcms['DOC_ROOT'] and $phpwcms['root'] in your "conf.inc.php" above. (You can always check what phpinfo is reporting for $_SERVER['DOCUMENT_ROOT'] to make sure it is picking it up correctly.)
mr_nabo wrote:[30-Aug-2007 02:38:32] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required '/Applications/MAMP/htdocs/include/inc_ext/Openads/Openads_function.php' (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Applications/MAMP/htdocs/phpwcms_1.3.3/include/inc_lib/default.inc.php on line 66
mr_nabo wrote:That suggests to me that I need to change the path somewhere in the config.inc.php file so that my phpwcms installation reads from the 'phpwcms_1.3.3' folder that is found in my root folder.
You're right (as you can see from the path differences of the error message). The code below defines the phpWCMS constants, then makes the call to require "Openads_function.php":


"/include/inc_lib/default.inc.php"

Code: Select all

if(!empty($phpwcms["root"])) {
	$phpwcms['DOC_ROOT']		.= 	'/'.$phpwcms["root"];
	$phpwcms["root"]			.= 	'/';
}

define ("PHPWCMS_ROOT", 			$phpwcms['DOC_ROOT']);
define ('PHPWCMS_FILES', 			$phpwcms["file_path"].'/');
define ('PHPWCMS_BASEPATH',			'/'.$phpwcms["root"]);
define ('On',						true);
define ('Off',						false);
define ('PHPWCMS_USER_KEY',			md5(getRemoteIP().$phpwcms['DOC_ROOT'].$phpwcms["db_pass"]));

require(PHPWCMS_ROOT.'/include/inc_ext/Openads/Openads_function.php');
$phpwcms['browser_detect']		=	phpAds_getUserAgent();
So the constant PHPWCMS_ROOT is apparently not being defined as you intended. Did you have any luck with turning on all warnings, notices and errors through "php.ini"? That might bring some error messages to light.
mr_nabo
Posts: 11
Joined: Thu 30. Aug 2007, 02:09

Post by mr_nabo »

Superb!

That was it. I needed the ports in the site url ($phpwcms['site'] = 'http://localhost:8888/').

Thank you both for your efforts, they are much appreciated.

All the best
Post Reply