select_db in mod_smf_login.php

Started by imrich, February 04, 2007, 04:35:11 PM

Previous topic - Next topic

imrich

Hi,

I've been trying to solve a problem which occured in bridge 1.1.6 and now again in 1.1.7.

I have SMF (1.1.1) and joomla (1.0.12) in separate databases.

I now have bridge 1.1.7 (Thanks so much, that upgrade went very smoothly) :)

I have some joomla components that seem to mess up the database connections (I don't know why). They tend to try to access Coppermine (which is in it's own database).

I get a lot of 'unable to select database' errors like this:

Quote
Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 150

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 150

Warning: mysql_query() [function.mysql-query]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 155

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 155

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 182

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 182

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 343

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 343


After changing all lines in mod_smf_login.php :

from

mysql_select_db($mosConfig_db);


to


mysql_select_db($mosConfig_db, $database->_resource);


AND also

from

mysql_select_db($db_name);


to


mysql_select_db($db_name, $GLOBALS['db_connection']);


(note, I also changed the recommended mysql_select_db($db_name) to mysql_select_db($db_name, $GLOBALS['db_connection']) in the bottom of my joomla template files (this was also giving me similar errors).

The problem is much MUCH better, however I do still see this error on some pages:

Quote
Warning: mysql_query() [function.mysql-query]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 155

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/usr/domains/mydomain.tld/public_html/modules/mod_smf_login.php on line 155

Perhaps I have the select_db resource link identifier wrong?

Any suggestions?

Orstio

Is one of your database users named "apache" ?

imrich

no, that is the strange thing!

From what I've been reading, if the resource link identifier is not specified, then the system will try the default user (in this case apache), this is why it says 'using password: NO'.

By specifying the resource link identifier, I got rid of a lot of the errors. Everything works MUCH better. I'm just stumped at this last error which is happening on the last line of this code:


$result = mysql_query("
        SELECT id
        FROM {$mosConfig_dbprefix}menu
        WHERE link = 'index.php?option=com_smf'");    <---- the error is being reported on this line



clintontull

will this fix the problem im seeing on my website with connection errors. on the Login module???
Reference this post here.

http://www.simplemachines.org/community/index.php?topic=154473.0

imrich

I wouldn't know, but looking at your error messages, they look different, so my quess would be 'no'.

I never heard back from Orstio after I answered him, so I still have this issue lurking.

I'm guessing it's a server configuration problem, but I haven't been able to find what it causing it.

Orstio

If you have Coppermine in its own database, does the Coppermine database user have access to the Joomla and SMF databases?

imrich

Quote from: Orstio on March 01, 2007, 05:44:34 PM
If you have Coppermine in its own database, does the Coppermine database user have access to the Joomla and SMF databases?

Hi Orstio,

I double checked.

Coppermine and SMF have access to the Joomla database
SMF and Joomla have access to the Coppermine database
Coppermine and Joomla have access to the SMF database

I still get errors like:

Warning: mysql_query() [function.mysql-query]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/user/domains/domain.tld/public_html/modules/mod_smf_login.php on line 156

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/user/domains/domain.tld/public_html/modules/mod_smf_login.php on line 156


I used to get a lot more of these, before I did the code changes as mentioned in the first post.

Thanks for any help, this is driving me crazy.



NeLLIsania

hi!

I'm using SMF 1.1.2 + Joomla 1.0.12 + Bridge 1.1.7. SMF and Joomla installed in same database. But I have some errors what describe in first post. I fix link resource, but problem still not resolve. :(

Warning: mysql_query() [function.mysql-query]: Access denied for user 'root'@'localhost' (using password: NO) in /usr/home/www/modules/mod_smf_login.php on line 155

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /usr/home/www/modules/mod_smf_login.php on line 155

Someone please help!

ЗЫ! Sorry for my pure english...
/* Have a nice day! */

Advertisement: