tamir
tamir

Reputation: 3297

Symfony2 phpunit gives 503 error

I signed up to GitHub and forked Symfony2. I tried to run the Symfony2 tests according to the instructions. I type > phpunit but every time, after some tests, I suddenly get out of memory message:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 40 bytes) in ...\Symfony\Component\HttpFoundation\HeaderBag.php on line 37

Then, the tests result is something like that:

503 Service Unavailable503 Service Unavailable503 Service Unavailable503 Service
Unavailable503 Service Unavailable503 Service Unavailable503 Service Unavailable

What may be causing it?

Upvotes: 2

Views: 957

Answers (2)

lascelles
lascelles

Reputation: 101

I ran into the same problem using the 2.0 branch. The full set of tests require approx. 163Mb of memory and like first answer said php defaults to 128M. You have two options.

Change the default max memory allocation to something greater than 163Mb.

memory_limit = 200M in php.ini

or

  • copy phpunit.xml.dist to phpunit.xml
  • alter the attribute bootstrap to read bootstrap="tests/local-bootstrap.php"
  • add an entry into your .gitignore for tests/local-bootstrap.php
  • create local-bootstrap.php with something like:

local-bootstrap.php

<?php
    ini_set('memory_limit', '200M'); // might need to adjust the value
    require 'bootstrap.php'          // no need to duplicate the bootstrap

This way allows you to add local changes without having to worry about git tacking any modifications to files that are local to your machine.

Upvotes: 4

Axxiss
Axxiss

Reputation: 4789

That is because the script exceeded the maximum amount of memory defined in php.ini

By default is 128M (134217728 bytes)

Here is explained http://php.net/memory-limit

Upvotes: 0

Related Questions