Wednesday, August 25, 2010

Symfony 1.4 - crashing when loading large fixture files

I have been trying to load a large fixture file in Symfony but everytime I went to load the fixture using doctrine:load-data, Symfony would crash. I looked at the mySQL tables and found that Symfony had in fact finished loading the fixture, but for some reason had become non-responsive.

To allow symfony to load the fixture (whether it crashes due to system resources like PHP memory or an issue with PHP itself), I found that I can control the loading of the fixture by following these simple steps.

  1. Split the fixture into several files (While keeping your table reference in each one)
  2. Load each fixture file 1 at a time (this can be accomplished using doctrine:data-load --append rel/path/to/fixture)
  3. check your tables to ensure data is still being loaded, if you find it has stalled more a good amount of time and nothing has been loaded, you will probably want to look into killing the PHP process (something I wont explain here) and doing some more fixture break downs.
Hopefully this will help some of you who have had the same issue I have been having.

1 comment:

transient said...

i had the same problem, and also split up my fixtures files, but if you have access to the php ini file, you might just try increasing the php memory limit. that worked for me, but maybe you have a REALLY big fixtures file that would break even a max memory limit.