nivanka
nivanka

Reputation: 1372

PHP memory limit is not being added osx

I am running on Mac OS X Lion 10.7.4,

i have php running and in /etc/php.ini i have set the memory limit to be 1024M

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 1024M

now when i run a script it gives me this error

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 474610 bytes) in

this looks like PHP has only 256 mega bytes of memory allocated, so where is the rest of the memory i am asking it to allocate ?

I am out of ideas to solve this here

Upvotes: 0

Views: 5487

Answers (5)

Liudmila
Liudmila

Reputation: 1

You can run php without memory limit. The command in terminal is: php -d memory_limit=-1 Symfony gives following solution: https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors

Upvotes: 0

Artur Black
Artur Black

Reputation: 231

Make sure that your web server is loading the corect php.ini file. You can check that by preparing a test php file with the following function call at the very beginning phpinfo(). It's important for you to make sure that the field Loaded Configuration File is the exact same as the path to the file you are editing.

Also, if you try to take a shortcut here and attempt to read the value of the mentioned configuration option from the PHP CLI you might run yourself into additional trouble. In many operating systems PHP CLI and PHP interpreter used by the local web server are using different configuration files. This means that output from phpinfo() run in PHP CLI might be different than when invoked through the web server.

Upvotes: 1

AdamJonR
AdamJonR

Reputation: 4713

When I get errors that don't seem to match behavioral expectations of php.ini settings, the second thing I do (the first thing, restarting the server, was already mentioned) is check that I edited the correct php.ini file. Try using phpinfo() in a page really quick to make ensure that the php.ini file you're editing is indeed the one being used according to the settings.

Upvotes: 1

bestprogrammerintheworld
bestprogrammerintheworld

Reputation: 5520

I have no experience in using silverstripe CMS, but I found this: http://www.silverstripe.org/general-questions/show/16355 and http://www.silverstripe.org/installing-silverstripe/show/20228

Maybe it can help you in right direction.

Another clue? (about php.ini) https://discussions.apple.com/thread/2446810?start=0&tstart=0

Upvotes: 1

chandresh_cool
chandresh_cool

Reputation: 11830

set your memory limit to -1

memory_limit = -1

Upvotes: 1

Related Questions