Like a Boss

I keep running into memory issues when running pretty intensive scripts from the PHP CLI especially when generating API documentation etc. Now if you don’t want to go and edit your php.ini you can simply add a runtime variable to increase your memory limit. It’s all thanks to the -d or -define option.

This option allows you to set a custom value for any of the configuration directives allowed in php.ini. PHP Documentation

An example would be:

php -d memory_limit=256M my_memory_heavy_script.php

You can also override any other options set in your php.ini.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Mojowill Avatar

Who the Hell am I?

I'm Will, a full time web developer, geek and musician. I develop using PHP and MySQL and spend most of my time working with WordPress or CakePHP. When I'm not buried in code I'm gaming, cooking or writing and recording music in my studio. I like sci-fi, pancakes and coffee and am totally prepared for the zombie apocalypse...

Stalk me on these other sites...

Why not be super creepy and check me out on all these other sites, I think they call it social media?

%d bloggers like this: