Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Database Connection Problems after PHP upgrade


Andydread

Recommended Posts

Posted

Hi I finally got osCommerce 2.2 running and it was running great except the catalog in the admin page was not working. I decided to update PHP from 4.1.0 to 4.3.9 on the HTTP and the HTTPS servers. The admin/categories works now on the HTTP server But I get this error when i connect to the HTTPS site. The HTTP site still works ok after I enabled globals in the php.ini file on both servers.

 

The HTTPS site is connecting to the database on the HTTP server. this was all working till i upgraded php.

 

Warning: mysql_connect(): Can't connect to MySQL server on 'www.mydomain.com' (0) in /opt/docs/secure/mydomain/catalog/admin/includes/functions/database.php on line 19

Unable to connect to database server!

 

Thanks

Posted

Did you enable globals in the php.ini AFTER you upgraded or before? If you did and that's a non-issue you can try changing 'localhost' in your config files to '127.0.0.1' and see if that makes a difference.

 

Vger

Posted
Did you enable globals in the php.ini AFTER you upgraded or before?  If you did and that's a non-issue you can try changing 'localhost' in your config files to '127.0.0.1' and see if that makes a difference.

 

Vger

 

There was no php.ini on either server before I updated but the PHP that was running before the upgrade (4.1.2) had it enabled by default without the need for a php.ini file.

Now that I upgraded to 4.3.9 I had to create a php.ini file in order to enable globals. I used the default php.ini file and simply enable globals on both servers. on the HTTP server, where the database is located i have no problems it is set to localhost.

on the HTTPS server, I have it set to '66.238.236.3' the ip address of the database server.

 

both 'localhost' and '127.0.0.1' works fine on the HTTP server but i get this error when i use 'localhost' or '127.0.0.1' on the HTTPS server

---------------------------------

1046 - No Database Selected

 

select configuration_key as cfgKey, configuration_value as cfgValue from configuration

 

[TEP STOP]

-----------------------------------

 

I believe this is because the database is actually located on the HTTP server and not the HTTPS server so I dont think localhost can be used on the HTTPS server. It was working when i had the config set to 'hostname' or 'ipaddr' before i updated php on the HTTPS server.

Posted

When you do a local install, in your configure.php files you define http as

 

define('HTTP_SERVER', 'http://localhost');

 

Why not try?

 

define('HTTPS_SERVER', 'https://localhost'); //or other variant

 

Vger

Posted
When you do a local install, in your configure.php files you define http as

 

define('HTTP_SERVER', 'http://localhost');

 

Why not try?

 

define('HTTPS_SERVER', 'https://localhost');  //or other variant

 

Vger

 

Here is what I have defined on the HTTPS server

// Define the webserver and path parameters

// * DIR_FS_* = Filesystem directories (local/physical)

// * DIR_WS_* = Webserver directories (virtual/URL)

define('HTTP_SERVER', 'http://www.bentleygardens.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://secure.emgrp.com/bentley/catalog'); // eg, https://localhost - should not be empty for productive serv

ers

 

I tried define('HTTPS_SERVER', 'https://localhost/bentley/catalog');

still did the same thing.

still getting

Warning: mysql_connect(): Can't connect to MySQL server on 'dorothy.emgrp.com' (0) in /opt/docs/secure/bentley/catalog/includes/functions/database.php on line 19

Unable to connect to database server!

 

 

The HTTPS server is supposed to connect to the database on the HTTP server.

which is 66.238.236.2

 

what boggles me is that this was all working before the php upgrade on the HTTPS server.

Posted

i had placed an answer before, your https server does not end in catalog, you need to remove that portion, as you have admin defined later in your configure.php as catalog/admin, hence you have catalog/catalog/admin as your path. and that will never work unless you create another catalog under catalog and place admin in there

Posted
i had placed an answer before, your https server does not end in catalog, you need to remove that portion, as you have admin defined later in your configure.php as catalog/admin, hence you have catalog/catalog/admin as your path.  and that will never work unless you create another catalog under catalog and place admin in there

 

 

yep thanks i fixed that on the earlier post.

That part is working and it was all working except the products/categories in the admin page did not work with php 4.1.2 so I upgraded and it now works on the HTTP server. I can see the categories now.

 

THe problem is that this only works on the HTTP where the database is lcocated. So on that server it is set to define('DB_SERVER', 'localhost'); and this is still working after the upgrade. The HTTPS server needs to connect to the MySQL on the HTTP server and this is what stopped working after the PHP upgrade.

I did not touch anything in any configure.php files. All I did was upgraded PHP.

 

 

I think I have narrowed it down to a PHP connect problem to remote hosts.

If i copy the database from the HTTP server to the HTTPS server and change the configure.php on the HTTPS server from define('DB_SERVER', '66.238.236.2');

to define('DB_SERVER', 'localhost');

then it works but its connecting to the wrong database. I do not want to run two databases. I want the HTTPS server to connect to the database on the HTTP server like it was doing Before i upgraded php from 4.1.2 to 4.3.9

It seems that after upgrading to php-4.3.9 PHP will now only connect to the local server through socket rather than through TCP to a remote MySQL server. It seems that PHP4.3.9 will not connect to any remote mysql database after the upgrade. Not sure if there is something in the php.ini file to fix this but the remote database connection was working before the PHP upgrade.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...