Last active
December 14, 2016 08:21
-
-
Save Leko/025b4d7fa192b106ea51b9078f31e749 to your computer and use it in GitHub Desktop.
PHP memory limit dealing when memory limit exceeded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SomeClass { | |
public function __destruct () | |
{ | |
echo __FILE__.':'.__LINE__.PHP_EOL; // Not working | |
} | |
} | |
register_shutdown_function(function () { | |
echo __FILE__.':'.__LINE__.PHP_EOL; // It works | |
}); | |
$instance = new SomeClass; | |
echo __FILE__.':'.__LINE__.PHP_EOL; // It works | |
range(0, 1000000000000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php -v | |
PHP 5.6.20 (cli) (built: Apr 28 2016 15:56:12) | |
Copyright (c) 1997-2016 The PHP Group | |
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies | |
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies | |
$ php memory-over.php | |
/Users/inoue.shingo/Downloads/memory-over.php:16 | |
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /Users/inoue.shingo/Downloads/memory-over.php on line 18 | |
/Users/inoue.shingo/Downloads/memory-over.php:11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment