I'm following along with the book "Agile Web Application Development with Yii 1.1 and PHP5" and I just started the part about unit testing in chapter 2.
When I follow the instructions on installing PHPUnit through PEAR, I receive a fatal error "Allowed memory size of x exhausted."
I tried increasing the allotted memory to 1024 in the top of PEAR.PHP using ini_set('memory_limit','1024M');
But this just caused CLI to crash.
Here's the full error message:
C:\xampp\htdocs\yii_sc2>pear channel-discover pear.phpunit.de
Fatal error:开发者_如何学Python Allowed memory size of 16777216 bytes exhausted (tried to allocate
269279590 bytes) in C:\xampp\php\PEAR\PEAR.php on line 719
Call Stack:
0.0015 535368 1. {main}() C:\xampp\php\PEAR\pearcmd.php:0
0.0986 3506816 2. PEAR::popErrorHandling() C:\xampp\php\PEAR\pearcmd.php:269
Any ideas?
Don't change the memory limit in the PEAR.php file. It will likely get overwritten once you update PEAR. If changing the memory limit in the php.ini for you php-cli executable does not make the error go away, try to run
peardev upgrade-all
which is the same command as pear
but has no memory limit. To install PHPUnit you have to have at least PEAR installer 1.9.1. You can verify your PEAR version by typing
pear version
Once everything is upgraded to the required version, run
peardev channel-discover pear.phpunit.de
peardev channel-discover components.ez.no
peardev channel-discover pear.symfony-project.com
peardev install --alldeps --force phpunit/PHPUnit
If that still results in errors, consider dropping by at the official support channels
- #pear at EFNet IRC
- #phpunit at Freenet IRC
You need to increase your memory_limit
parameter in your php.ini
file.
Your current value is: memory_limit = 16M
Change it to: memory_limit = 64M
(or more, if you need)
精彩评论