DEV Community

Adamo Crespi for Serendipity HQ

Posted on • Originally published at io.serendipityhq.com on

How to increase PHP memory_limit on CodeShip.io

Some days ago I found myself on front o f a problem: my unit tests failed because of lack of PHP memory.

This were the tedious error:

PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16640 bytes)

As I use CodeShip.io as continuous delivery server, I had to increase the PHP memory_limit on their systems, but… how?

So I googled for a solution, but nothing helped me.

The last chance were to contact the support. As ever, the astonishing CodeShip.io’s support replied me with this email:

PHP is limited to 256MB memory by default on the build VMs (which you just barely exceeded it). But you have access to the php.ini and can configure the limit yourself. The file is located at

${HOME}/.phpenv/versions/${YOUR_PHP_VERSION}/etc/php.ini

and e.g. the following sed call would achieve increasing the limit

sed -i'' 's/^memory_limit=.*/memory_limit = 512m/g' .phpenv/versions/5.6/etc/php.ini
CodeShip support

So, a simple line in my setup commands, increased the default php memory_limit:

sed -i'' 's/^memory_limit=.*/memory_limit = 512m/g' ${HOME}/.phpenv/versions/5.6/etc/php.ini
Enter fullscreen mode Exit fullscreen mode

Remember to “Make. Ideas. Happen.”.

I wish you flocking users, see you soon!

L'articolo How to increase PHP memory_limit on CodeShip.io proviene da ÐΞV Experiences by Serendipity HQ.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay