Re: keep hitting mysql memory limit, even in Cake Shell when exporting large xml file
It seems like a PHP memory limit error rather than MySQL as Waither said, PHP on a standard install has a limit of 64mb, I never find this enough, especially dealing with largew datasets. Seting the memory limit to 128 should suffice, either in the actual file, or in the php.ini. Personally I raised the limit to 128mb for php and 512mb for MySQL. On Jul 26, 4:02 pm, JamesF wrote: > i have paginated the results and no matter how i chunk it it still > fills up the mysqli result set and hits the memory limit. i need to be > able to flush the result set between each iteration. > > On Jul 26, 6:33 am, Jaydeep Dave wrote: > > > You can try something like this in your shell > > > > > ... > > .. > > > $page = 1; > > > while(1) { > > > $records = $this->findAll("conditions' => array(bla bla bla), > > 'fields' => 'Model.*' ,'limit' => 50, 'page' => $page); > > > if($records) { > > // Write Your XML in a File. > > }else{ > > break; > > } > > > $page = $page + 50; > > > } > > > This will help you a lot. > > > Regards, > > > Jaydeep Dave > > > On Sun, Jul 26, 2009 at 1:41 AM, majna wrote: > > > > Try with : > > > $mysqli = ConnectionManager::getDataSource('default'); > > > $mysqli->disconnect(); > > > $mysqli->connect(); > > > > debug($mysqli->connected); > > > debug($mysqli->connection); > > > > On Jul 26, 7:55 am, JamesF wrote: > > > > MY PROBLEM: > > > > i am running into a wall with this one. basically i have a large xml > > > > file that i am rendering using XmlHelper. We are talking about a > > > > 25-50mb file. This is basically a product data feed. I have tried > > > > quite a few methods to overcome the memory limit but no luck. > > > > > MY ERROR: > > > > Fatal error: Allowed memory size of 83886080 bytes exhausted (tried to > > > > allocate 53 bytes) in /home/username/usr/cakedev/cake/libs/model/ > > > > datasources/dbo/dbo_mysqli.php on line 402 > > > > > WHAT I HAVE DONE TO TRY AND FIX IT: > > > > > 1) Initially i set this up to render through the web in one > > > > shotthis cause execution limit timeouts and memory errors. > > > > > 2)I broke up the data requests in seperate chunks of 500 records using > > > > internal method calls, like $listings = $this->getListings($start_id, > > > > $limit); This caused the same problem > > > > > 3) I set the whole thing up via the cake shell interface. It works > > > > great except for the fact that i keep running up against the same > > > > limit, even with staggered chunks of records in different method > > > > calls. > > > > > MY GUESS: > > > > is that Cake is keeping an open connection with the database for the > > > > life of the script. > > > > > MY SPECIFIC QUESTIONS: > > > > can i disconnect and reconnect from the database inside of the script? > > > > specifically can i do this in a cake shell script? will this solve my > > > > memory problem? am i going about this the wrong way entirely? > > > > > thanks again anyone who has some advice! > > > -- > > Regards, > > > Jaydeep Dave > > Mobile: +919898456445 > > Email: jaydipd...@yahoo.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
hasMany
So I am stuck on how to get this working correctly. This is what I want to happen: Many Records can belong to one Schedule with a maximum of 10 but that part doesnt matter as that comes in at validation.. So I have two tables the structure looks like this Records (PK) id - auto_incremental (FK) registration order_number ... Now this table is fine, what I want to happen is once the records are selected it will create the records in Schedules, at the moment Schedules looks like Schedules (PK) id - auto_incremental (F) record_id This is where I get stuck as many records can belong to one schedule, how am I going to link them all to the same unique field without it being auto_incremental.. Anyone got any ideas on how I should do this, also how do you handle multiple edits in one go... is there a built in function to create a multi select? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Default Date Format
Thats all very well, but i want to set it in $form->input On Sep 9, 7:03 pm, "Yodi Aditya" <[EMAIL PROTECTED]> wrote: > use date function. in controller. > for example, date('Y-m-d H:i:s') > > On 9/8/08, shabba <[EMAIL PROTECTED]> wrote: > > > > > How do you set the default formatting for date. Its set to m-d-y as > > default, this is great, but when you need user interaction and the > > standard is d-m-Y. Its really not practical to add formatting to each > > $form->input, is there a better way? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Default Date Format
How do you set the default formatting for date. Its set to m-d-y as default, this is great, but when you need user interaction and the standard is d-m-Y. Its really not practical to add formatting to each $form->input, is there a better way? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Auth Component - I'm going crazy
I also had this problem its caused because your not allowing a certain page. Action, my problem was that I had a element that was dynamically loading data. Instead I created a new layout just for the login that solved the problem. Here is what my app controller looks like. class AppController extends Controller { var $components = array('Auth'); /** * Load the Authentication * * @access public */ function beforeFilter(){ $this->layout = 'login'; $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login'); $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'home'); $this->Auth->logoutRedirect = '/users/login'; $this->Auth->allow('login'); $this->Auth->authorize = 'controller'; } function isAuthorized() { return true; } } On Aug 25, 8:32 pm, luigi7up <[EMAIL PROTECTED]> wrote: > Ola, everyone... > > //Using RC2 version of CakePHP > > I'm building simple application that allows users to write articles. > So there are their corresponding models and controllers. > > Few days ago I made custom Login/register part of application that > writes username to session etc. but now I decided to use Auth > component for this purpose. > As soon as I define: > var $components = array('Auth'); > in my users_controller or app_controller, application stops working. > Firefox gives following error: "Firefox has detected that the server > is redirecting the request for this address in a way that will never > complete." So, some infinite loop occured definitely and I'm quite > sure that I didn't cause it :) > > I found few posts about this problem but none of them resolves my > problem. > > The weirdest thing,to me, is that error occurs as soon as I include > Auth component; I don't even use one method of that class ?!? > Also another confusing part with this problem is that my other > controllers also stop working with same output eventhough component > Auth is included only in users_controller. User model is in > association with articles model but I think that articles_controller > shoud with or without component Auth included in users_controller. Am > I wrong? > > My database is USERS and has fields username and password and also > there is a model for users table. > > Thanks in advance > > Luka --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Listing all table fields
I am creating a controller that outputs all of the table fields so the user can create a iTunes like playlists on the fly. Whats the best way to do this? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Form Helper
I'm trying to use the form helper to display drop down menu date fields. Now if I want to display datetime it works, but when I try and do the same thing for date I get this error: Warning (512): Method FormHelper::date does not exist [CORE/cake/libs/ view/helper.php, line 148] The code from my view is Add Task create('Task'); echo $form->input('title'); echo $form->input('description', array('rows' => '3')); echo $form->input('context'); echo $form->input('project'); echo $form->date('due'); echo $form->end('Save Task'); ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---