useDbconfig not working on ubuntu
Hi, I am using 1.3.8 cakephp for my company website. The production server is 10.0.4 ubuntu server. I am using two databases db1 and db2. I have db1 and db2 details in database.php file. I have db1 details defined as var $default and db2 details defined as var $db2. I have persistent set to false in database.php I have even cleared the cache in app's tmp folder.Someway cakephp is failing to recognize the second database. The same configuration works on my development machine which is Mac OS X but it fails on ubuntu. Any help is appreciated. Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: $useDbConfig not working
Please show the code where you are setting the $useDbConfig, and what is the name of the file in which you are doing it! Enjoy, John On Mar 30, 8:31 am, mattmemo knockdownsh...@gmail.com wrote: Hello, I would like to have two different database configurations. For my Projects controller, I would like to use $default, and for my Employees controller, I would like to use $server4. In my model Employee.php, I set var $useDbConfig = 'server4'; no matter what I do, I can't get these two to work. If configured above, the projects controller connects correctly but the employees controller gives the error Database table employees for model Employee was not found. If I switch $server4 to $default, the employees controller works but I get the missing table error for the Projects controller. For some reason, the $useDbConfig is being ignored or something. I am running cakePHP 1.2.6 on ubuntu server with apache2 Anyone know why this would be happening? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
$useDbConfig not working
Hello, I would like to have two different database configurations. For my Projects controller, I would like to use $default, and for my Employees controller, I would like to use $server4. In my model Employee.php, I set var $useDbConfig = 'server4'; no matter what I do, I can't get these two to work. If configured above, the projects controller connects correctly but the employees controller gives the error Database table employees for model Employee was not found. If I switch $server4 to $default, the employees controller works but I get the missing table error for the Projects controller. For some reason, the $useDbConfig is being ignored or something. I am running cakePHP 1.2.6 on ubuntu server with apache2 Anyone know why this would be happening? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: var $useDbConfig not working - caching?
Hi Komaruloh, Thanks for your help. I actually have persistent set to false. Here's the content of my database.php file. Nothing out of the ordinary here? class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); var $production = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); } On Jul 14, 4:16 am, komaruloh komaru...@gmail.com wrote: I'm not sure if it's all about cache. But perhaps you could add this option to your database.php var $default = array( . . . 'persistent' = false, . . . ); var $prod = array( . . . 'persistent' = false, . . . ); Hope it will solve your problem. Komaruloh, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
hi Alastair, Here's the content of my database.php file. Nothing out of the ordinary here? class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); var $production = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); } Another option (this is what I do) would be to have just one db config called default, but define the class in a switch statement that's checking the HTTP_HOST. ?php switch (env('HTTP_HOST')) { // Local/dev version case 'local.domain.com': case '127.0.0.1': class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); } break; // Live default: class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); break; } ? I use this same technique to turn on/off debug, caching etc, means one set of app files can be SVNd to different environments without changes. Been meaning to blog about it, will try to soon. hth jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
Ahh lovely! That works perfect. Still not sure what was causing the problem I've been discussing but it doesn't matter for the time being. Get that blogged! Or I'll do it :) On Jul 14, 11:31 am, Jon Bennett jmbenn...@gmail.com wrote: hi Alastair, Here's the content of my database.php file. Nothing out of the ordinary here? class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); var $production = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); } Another option (this is what I do) would be to have just one db config called default, but define the class in a switch statement that's checking the HTTP_HOST. ?php switch (env('HTTP_HOST')) { // Local/dev version case 'local.domain.com': case '127.0.0.1': class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); } break; // Live default: class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); break; } ? I use this same technique to turn on/off debug, caching etc, means one set of app files can be SVNd to different environments without changes. Been meaning to blog about it, will try to soon. hth jon -- jon bennett w:http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
How to switch DB connections based on environment automatically. http://edwardawebb.com/programming/php-programming/cakephp/automatically-choose-database-connections-cakephp On Jul 14, 6:55 am, Alastair alast...@zanginteractive.com wrote: Ahh lovely! That works perfect. Still not sure what was causing the problem I've been discussing but it doesn't matter for the time being. Get that blogged! Or I'll do it :) On Jul 14, 11:31 am, Jon Bennett jmbenn...@gmail.com wrote: hi Alastair, Here's the content of my database.php file. Nothing out of the ordinary here? class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); var $production = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); } Another option (this is what I do) would be to have just one db config called default, but define the class in a switch statement that's checking the HTTP_HOST. ?php switch (env('HTTP_HOST')) { // Local/dev version case 'local.domain.com': case '127.0.0.1': class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); } break; // Live default: class DATABASE_CONFIG { var $default = array( 'driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'X', 'password' = 'X', 'database' = 'landscaper', 'prefix' = '', ); break; } ? I use this same technique to turn on/off debug, caching etc, means one set of app files can be SVNd to different environments without changes. Been meaning to blog about it, will try to soon. hth jon -- jon bennett w:http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
On Jul 14, 1:24 pm, Smelly Eddie ollit...@gmail.com wrote: How to switch DB connections based on environment automatically.http://edwardawebb.com/programming/php-programming/cakephp/automatica... Thanks for this link, a slightly more robust solution! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
How to switch DB connections based on environment automatically. http://edwardawebb.com/programming/php-programming/cakephp/automatically-choose-database-connections-cakephp nice :) You can't do that in core.php or bootstrap.php or webroot/index.php though, as they aren't classes, so I think I'd stick with my way which can be replicated across all those files without changes. jb -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
I'm not sure if it's all about cache. But perhaps you could add this option to your database.php var $default = array( . . . 'persistent' = false, . . . ); var $prod = array( . . . 'persistent' = false, . . . ); Hope it will solve your problem. Komaruloh, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
Hi Komaruloh, I wonder if your mail client is having problems because you posted this twice earlier. As I said in my reply, this isn't the issue but it's been resolved now so many thanks for your suggestion. Alastair On Jul 14, 4:25 am, komaruloh komaru...@gmail.com wrote: I'm not sure if it's all about cache. But perhaps you could add this option to your database.php var $default = array( . . . 'persistent' = false, . . . ); var $prod = array( . . . 'persistent' = false, . . . ); Hope it will solve your problem. Komaruloh, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
On Jul 7, 3:37 pm, Robert P shiftyrobs...@gmail.com wrote: The first step in trying to debug a possible caching issue is to navigate through all the folders under /app/tmp/cache and delete every file. Any future uploads should not include the /app/tmp directory. If the issue persists it's not a problem with caching. I didn't manage to get any further with this. I've even tried putting var $useDbConfig = 'prod'; in each of my models but still it appears to be using the default config. I've cleared the cache and have actually redeployed the site elsewhere. Still the same problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
Ok, while I haven't solved the problem, I've managed to get a little more information from this. It is definitely using the $default database configuration. If I don't have the $default set up, it fails with an error message. Fatal Error (256): ConnectionManager::getDataSource - Non-existent data source default However, it appears to be looking for my $production (I've since renamed $prod to $production) configuration. If I don't have a $production configuration in my database.php file, it fails also although with a different error message. Fatal Error (256): ConnectionManager::getDataSource - Non-existent data source production app_model.php looks like: lass AppModel extends Model { var $actsAs = array('Containable'); var $recursive = -1; var $useDbConfig = 'production'; } I'm convinced some kind of caching is going on but the cache directory is being emptied when I run a test as is the browser cache. I'm not doing anything unusual with my databases and I did have this working a little while ago so what is going on is anyone's guess. Alastair --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
I'm not sure if it's all about cache. But perhaps you could add this option to your database.php var $default = array( . . . 'persistent' = false, . . . ); var $prod = array( . . . 'persistent' = false, . . . ); Hope it will solve your problem. Komaruloh, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
I'm not sure if it's all about cache. But perhaps you could add this option to your database.php var $default = array( . . . 'persistent' = false, . . . ); var $prod = array( . . . 'persistent' = false, . . . ); Hope it will solve your problem. Komaruloh, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
Incidentally, commenting/uncommenting var $useDbConfig = 'prod'; in my app_model does apply the database settings on my local machine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: var $useDbConfig not working - caching?
The first step in trying to debug a possible caching issue is to navigate through all the folders under /app/tmp/cache and delete every file. Any future uploads should not include the /app/tmp directory. If the issue persists it's not a problem with caching. On Jul 7, 10:28 pm, Alastair m...@alastairmoore.com wrote: Hi Cake fans, I'm currently developing locally and uploading intermittently to my remote server. I have $default and $prod database configurations set up in my database.php file, however on setting var $useDbConfig = 'prod'; in app_model.php and uploading this to my remote server, it's still using the $default settings. Is it possible that there's some caching going on? Or could this be down to a different reason? I'm not clearing the remote tmp directory when I upload the amends. Little puzzled about this one! Any advice? Thanks, Alastair --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
var $useDbConfig not working - caching?
Hi Cake fans, I'm currently developing locally and uploading intermittently to my remote server. I have $default and $prod database configurations set up in my database.php file, however on setting var $useDbConfig = 'prod'; in app_model.php and uploading this to my remote server, it's still using the $default settings. Is it possible that there's some caching going on? Or could this be down to a different reason? I'm not clearing the remote tmp directory when I upload the amends. Little puzzled about this one! Any advice? Thanks, Alastair --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---