Re: [PHP-DB] Database visible via mysql CLI but not MOD_PHP withsame username
OK I will look further and try these ideas today. Cheers, M. Bastien Koert wrote: sounds like a mysql account user permissions problem to me, too bastien From: Martin Norland [EMAIL PROTECTED] Reply-To: php-db@lists.php.net To: php-db@lists.php.net Subject: Re: [PHP-DB] Database visible via mysql CLI but not MOD_PHP withsame username Date: Tue, 15 Feb 2005 15:59:09 -0600 Elliot Mackenzie wrote: I have encountered a hidden database issue with mod_php, apache2 and mySQL that I have thus far been unable to resolve. I am able to connect to the mysql socket using mysql_connect, but then find that mysql_list_dbs only returns the test database. This *sounded* like an issue with the SHOW DATABASES privilege until I found I was able to log in to the same MySQL server *as the same user* with the provided command-line client (mysql) and SHOW DATABASES would display all the other databases on this system. Furthermore, I tried connecting as root, and again found only the test database was visible to PHP. If I dropped the test database, no databases were visible to PHP (regardless of how many databases were visible using SHOW DATABASES). If I created test, tester, testing, hello etc, then the test database would reappear to PHP, but no other databases were visible. I also tried to connect PHP to MySQL as a super-user, and encountered the exact same issue. Steps to confirm question: 1) Connect using php, drop 'test' database. 2) Confirm php no longer sees 'test' database. 3) Connect using mysql client, confirm test database is missing. 4) -\ 4a) if so, check mysql database to confirm permissions for root include '%' databases and not just 'test'. 4b) if not, change php code to connect to correct mysql server. Apologies that this may not be very useful, but your problem is extremely odd - if it's *not* a permissions / database error. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database visible via mysql CLI but not MOD_PHP with
Agh! GLOBALS GLOBALS GLOBALS. For a future suckers' reference, the variable was not available in its scope, and was thus passing null as the username to mysql_connect, which in turn was connecting to the database as @localhost. Thanks for your help, pardon my stupidity :) Kind regards, Elliot. On Wed, 16 Feb 2005, Elliot Mackenzie wrote: I have an update for this. I used mysql_connect to connect to the database and then ran the query select current_user(). I discovered that despite using mysql_connect specifying a username and password, it still insisted on connecting as @localhost, but with no user. The @localhost user does not have the permissions it needs to show databases other than test, and this explains 100% why I am seeing the results I am seeing. I can login to the command-line client and see exactly what PHP is seeing now (which is a relief). The question is now: why would I be connecting as @localhost instead of [EMAIL PROTECTED] when I specify both a username and password along with mysql_connect? There are no mysql-related defaults set in php.ini other than a path to the socket. Kind regards, Elliot. Martin Norland wrote: Elliot Mackenzie wrote: I have encountered a hidden database issue with mod_php, apache2 and mySQL that I have thus far been unable to resolve. I am able to connect to the mysql socket using mysql_connect, but then find that mysql_list_dbs only returns the test database. This *sounded* like an issue with the SHOW DATABASES privilege until I found I was able to log in to the same MySQL server *as the same user* with the provided command-line client (mysql) and SHOW DATABASES would display all the other databases on this system. Furthermore, I tried connecting as root, and again found only the test database was visible to PHP. If I dropped the test database, no databases were visible to PHP (regardless of how many databases were visible using SHOW DATABASES). If I created test, tester, testing, hello etc, then the test database would reappear to PHP, but no other databases were visible. I also tried to connect PHP to MySQL as a super-user, and encountered the exact same issue. Steps to confirm question: 1) Connect using php, drop 'test' database. 2) Confirm php no longer sees 'test' database. 3) Connect using mysql client, confirm test database is missing. 4) -\ 4a) if so, check mysql database to confirm permissions for root include '%' databases and not just 'test'. 4b) if not, change php code to connect to correct mysql server. Apologies that this may not be very useful, but your problem is extremely odd - if it's *not* a permissions / database error. Cheers, -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database visible via mysql CLI but not MOD_PHP with
I have an update for this. I used mysql_connect to connect to the database and then ran the query select current_user(). I discovered that despite using mysql_connect specifying a username and password, it still insisted on connecting as @localhost, but with no user. The @localhost user does not have the permissions it needs to show databases other than test, and this explains 100% why I am seeing the results I am seeing. I can login to the command-line client and see exactly what PHP is seeing now (which is a relief). The question is now: why would I be connecting as @localhost instead of [EMAIL PROTECTED] when I specify both a username and password along with mysql_connect? There are no mysql-related defaults set in php.ini other than a path to the socket. Kind regards, Elliot. Martin Norland wrote: Elliot Mackenzie wrote: I have encountered a hidden database issue with mod_php, apache2 and mySQL that I have thus far been unable to resolve. I am able to connect to the mysql socket using mysql_connect, but then find that mysql_list_dbs only returns the test database. This *sounded* like an issue with the SHOW DATABASES privilege until I found I was able to log in to the same MySQL server *as the same user* with the provided command-line client (mysql) and SHOW DATABASES would display all the other databases on this system. Furthermore, I tried connecting as root, and again found only the test database was visible to PHP. If I dropped the test database, no databases were visible to PHP (regardless of how many databases were visible using SHOW DATABASES). If I created test, tester, testing, hello etc, then the test database would reappear to PHP, but no other databases were visible. I also tried to connect PHP to MySQL as a super-user, and encountered the exact same issue. Steps to confirm question: 1) Connect using php, drop 'test' database. 2) Confirm php no longer sees 'test' database. 3) Connect using mysql client, confirm test database is missing. 4) -\ 4a) if so, check mysql database to confirm permissions for root include '%' databases and not just 'test'. 4b) if not, change php code to connect to correct mysql server. Apologies that this may not be very useful, but your problem is extremely odd - if it's *not* a permissions / database error. Cheers, -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Database visible via mysql CLI but not MOD_PHP with same username
I have encountered a hidden database issue with mod_php, apache2 and mySQL that I have thus far been unable to resolve. I am able to connect to the mysql socket using mysql_connect, but then find that mysql_list_dbs only returns the test database. This *sounded* like an issue with the SHOW DATABASES privilege until I found I was able to log in to the same MySQL server *as the same user* with the provided command-line client (mysql) and SHOW DATABASES would display all the other databases on this system. Furthermore, I tried connecting as root, and again found only the test database was visible to PHP. If I dropped the test database, no databases were visible to PHP (regardless of how many databases were visible using SHOW DATABASES). If I created test, tester, testing, hello etc, then the test database would reappear to PHP, but no other databases were visible. I also tried to connect PHP to MySQL as a super-user, and encountered the exact same issue. Any advice appreciated, M. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database visible via mysql CLI but not MOD_PHP with same username
Elliot Mackenzie wrote: I have encountered a hidden database issue with mod_php, apache2 and mySQL that I have thus far been unable to resolve. I am able to connect to the mysql socket using mysql_connect, but then find that mysql_list_dbs only returns the test database. This *sounded* like an issue with the SHOW DATABASES privilege until I found I was able to log in to the same MySQL server *as the same user* with the provided command-line client (mysql) and SHOW DATABASES would display all the other databases on this system. Furthermore, I tried connecting as root, and again found only the test database was visible to PHP. If I dropped the test database, no databases were visible to PHP (regardless of how many databases were visible using SHOW DATABASES). If I created test, tester, testing, hello etc, then the test database would reappear to PHP, but no other databases were visible. I also tried to connect PHP to MySQL as a super-user, and encountered the exact same issue. Steps to confirm question: 1) Connect using php, drop 'test' database. 2) Confirm php no longer sees 'test' database. 3) Connect using mysql client, confirm test database is missing. 4) -\ 4a) if so, check mysql database to confirm permissions for root include '%' databases and not just 'test'. 4b) if not, change php code to connect to correct mysql server. Apologies that this may not be very useful, but your problem is extremely odd - if it's *not* a permissions / database error. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database visible via mysql CLI but not MOD_PHP withsame username
sounds like a mysql account user permissions problem to me, too bastien From: Martin Norland [EMAIL PROTECTED] Reply-To: php-db@lists.php.net To: php-db@lists.php.net Subject: Re: [PHP-DB] Database visible via mysql CLI but not MOD_PHP withsame username Date: Tue, 15 Feb 2005 15:59:09 -0600 Elliot Mackenzie wrote: I have encountered a hidden database issue with mod_php, apache2 and mySQL that I have thus far been unable to resolve. I am able to connect to the mysql socket using mysql_connect, but then find that mysql_list_dbs only returns the test database. This *sounded* like an issue with the SHOW DATABASES privilege until I found I was able to log in to the same MySQL server *as the same user* with the provided command-line client (mysql) and SHOW DATABASES would display all the other databases on this system. Furthermore, I tried connecting as root, and again found only the test database was visible to PHP. If I dropped the test database, no databases were visible to PHP (regardless of how many databases were visible using SHOW DATABASES). If I created test, tester, testing, hello etc, then the test database would reappear to PHP, but no other databases were visible. I also tried to connect PHP to MySQL as a super-user, and encountered the exact same issue. Steps to confirm question: 1) Connect using php, drop 'test' database. 2) Confirm php no longer sees 'test' database. 3) Connect using mysql client, confirm test database is missing. 4) -\ 4a) if so, check mysql database to confirm permissions for root include '%' databases and not just 'test'. 4b) if not, change php code to connect to correct mysql server. Apologies that this may not be very useful, but your problem is extremely odd - if it's *not* a permissions / database error. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php