No announcement yet.

SOLUTION: "PHP Fatal error: Allowed memory size of 268435456 bytes exhausted"

  • Filter
  • Time
  • Show
Clear All
new posts

  • SOLUTION: "PHP Fatal error: Allowed memory size of 268435456 bytes exhausted"

    Hi everyone! So I don't know if anyone else has tried using PTS on Ubuntu (or LinuxMint) recently, but I have; and when downloading certain tests I would get this error. (Specifically the pts/doom3 test)

    PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 980120246 bytes) in /usr/share/phoronix-test-suite/pts-core/objects/pts_network.php on line 65

    I spent days fretting over this...I first tried installing curl, as the pts_network.php file suggested doing, but afterward the download merely got stuck. Then I tried changing the "ini_set('memory_limit', '256M');" line in /pts-core/phoronix-test-suite.php to 512M, 1024M, etc. However this would cause a segmentation fault when retrying to install the pts/doom3 test. Apparently you can't change that. However, then I tried changing the memory_limit in my system php.ini file (/etc/php5/cli/php.ini) to unlimited (-1)...but still no avail. Then I discovered there were a few more php ini files in /usr/share/php5/php.ini-production, /usr/share/php5/php.ini-production.cli, /usr/share/php5/php.ini-production-dist. I changed the values on those but still no help. The download stopped getting the PHP Fatal error, however it would just hang after a while. Then I found out about a couple other variables in the php configuration files called the "max_execution_time" and "max_input_time". They were both set to something like 30 and 60 seconds and I believe that these were timing out the download. So here is what I did.



    Set these variables, and comment out the originals.

    max_execution_time = 0
    max_input_time = -1
    memory_limit = -1

    That's it! It probably isn't the best way...but hey it worked! And you can always set these back after you're done with PTS. P.S. I'm not sure if it's necessary to apply the same changes to ALL those files..but I believe when I changed only the "/etc/php5/cli/php.ini" it did not work. Anyone else having this problem, tell me if this fixed it for you. Hopefully it does and you don't have to go through what I went through. Cheers!

  • #2
    UPDATE: Forget everything I said...

    I did some more tests and apparently that solution only works some of the time. I purged php5-cli, phoronix-test-suite, and then reinstalled them along with php5-curl and it seemed to work. Although, I was monitoring my network traffic, and with php5-curl I get quite a few hangs in my downloads. Also I shouldn't have to necessarily install curl, phoronix is supposed to support php stream downloads as well. I just can't seem to find a fool proof way of getting around that "PHP Fatal error: Allowed memory size of 268435456 bytes exhausted". I might try a few more things. As for now I'm just sticking curl because it works, even if it isn't perfect.