Increase PHP memory limit on Ubuntu 14.04

php

#1

Hello! I have the following circle.yml config, running under Ubuntu 14.04:

machine:
    php:
        version: 5.6.17
dependencies:
    pre:
        - echo "memory_limit = 512M" > ~/.phpenv/versions/5.6.17/etc/conf.d/memory.ini
test:
    # etc.

My build is failing like so:

bash: line 1: /opt/circleci/php/etc/conf.d/memory.ini: No such file or directory
echo "memory_limit = 512M" > /opt/circleci/php/etc/conf.d/memory.ini returned exit code 1
Action failed: echo "memory_limit = 512M" > /opt/circleci/php/etc/conf.d/memory.ini

Per the suggestion here, I tried changing this line to:

- echo "memory_limit = 512M" > /opt/circleci/php/$(phpenv global)etc/conf.d/memory.ini

Of course it had no effect, as I suspect this is a difference in how PHP is configured. (We just upgraded from 5.5 and Ubuntu 12.02.) Is there a recommended way to set the PHP memory limit under these circumstances?

Thanks!


#2

Bah, I just had a typo. Got it. The correct config was:

- echo "memory_limit = 512M" > /opt/circleci/php/$(phpenv global)/etc/conf.d/memory.ini

#3

Glad you figured it out. Post like these help people in the future when they are searching for a solution to their problem so thanks for coming back and posting yours. :smile:


#4

Actually, IMO is better to use the PHPENV_ROOT env var, so your code would be:

`

  • echo “memory_limit = 512M” > PHPENV_ROOT/versions/(phpenv global)/etc/conf.d/memory.ini
    `

#5