Hi,
I want to point to a remote server in the config.php. I changed the code to:
$config_databaseServer = "66.98.226.4";
After that I got a lot of errors in the includes/database.php
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 17
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 26
And when I try to register the datafeed I also get a lot of error messaes:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 17
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 26
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 17
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 26
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 17
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 21
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 26
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 43
Warning: mysql_insert_id() [function.mysql-insert-id]: A link to the server could not be established in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 45
Warning: mysql_affected_rows() [function.mysql-affected-rows]: A link to the server could not be established in /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php on line 47
Warning: Cannot modify header information - headers already sent by (output started at /mnt/ja2/04/811/00000013/htdocs/sun-glass/includes/database.php:17) in /mnt/ja2/04/811/00000013/htdocs/sun-glass/admin/feeds_register_step2.php on line 76
Is PT not ready for access remote databases?
Roland
Thanks David,
the code
$config_databaseServer = "66.98.226.4";
was given me from my host, so I believe that this is correct.
With my access hosts I allowed wildcard connections.
I am trying again.
Thanks
Roland
Hi David,
I could not manage to connect to the database. Let me say:
I want the config file of PT on xxxx.com connect to the database of the server yyyyy.com.
I think that the reason is that what you mentioned. Do you know a way to manage that either?
Regards
Roland
Hi Roland,
If it is down to the username only being permitted to connect from LOCALHOST then it will have to be changed by the database administrator so its probably best to contact their support line.
I would recommended testing this outside of Price Tapestry, using the example scripts from the PHP website:
http://uk2.php.net/mysql_connect
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
In this case, replace localhost with that IP address that you were given for your database server, and of course set your username and password as advised. You should then be able to see the error message returned by the MySQL library which may help.
Cheers,
David.
David,
If I have remote database, is it enought to add "Access Host" in DirectAdmin and change config.php in this way?
$config_databaseServer = "xx.xxx.xx.xxx";
$config_databaseUsername = "username";
$config_databasePassword = "password";
$config_databaseName = "dbname;
Is there any other changes should be made?
Thanks,
Karolis
Hi Karolis,
That's correct - $config_databaseServer and be an IP address or fully qualified host name if the MySQL server is remote and not localhost...
Cheers,
David.
--
PriceTapestry.com
After some extra server configuration, finally it went successfully. thanks!
Hi Roland,
Have you confirmed that the remote server is accepting connections from the server that you are running Price Tapestry on?
To do this, either Telnet or SSH in to your source box and then try to Telnet into the MySQL port on the remote server, for example:
$telnet 66.98.226.4 3306
If the server is listening, the most likely reason I can think of that is causing mysql_connect() to not be able to establish a link is because the username that you are using is only permitted for a localhost connection. A MySQL username is actually stored something like an email address - username@host. If the username you are using is configured as username@LOCALHOST or username@127.0.01 then mysql_connect would fail - so that is something to look at.
Hope this helps!
Cheers,
David.