How to adjust Php Woker Settings on App Platform ( Worker) ( memory_limit) ?

Posted November 21, 2021 89 views
PHPDigitalOcean App Platform

Im Setting up a Laravel on App Platform. I use horizon (with redis) for the Queue. And two dedicated Worker ( from App Platform) to run horizon and the scheduler. Everything is running and working as expected. The only issue that i have is that i dont find a way to change memorylimit for my php worker. The worker is using the same repo and ignores the user.ini in public folder which works for the Laravel App.
My app is importing huge Data in long running Jobs. I already Chunked the jobs but im every time running in timeouts or memory issues.
Someone went trough this already or can give me hints how to adjust the memory
limit and other php settings?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hi @chhaaks,

I’ll recommend going over the documentation, it can be really helpful.

Go to, click on your app, and click on the Settings tab. Click the Worker you’d like to edit.

You can use the configuration settings you see here to change the Worker’s scaling behavior, modify environment variables, edit commands, and more.

Scaling is the process of adding more capacity to a component in your app. There are two kinds of scaling in App Platform:

  • Horizontal scaling adds more containers, which will be load-balanced.

  • Vertical scaling increases the amount of CPU and memory allocated to each container instance.

You can control how each component in an app scales. This configuration is available both in the app spec and in the control panel.

Hi @KFSys,

thanks for your answer.
The worker itself is currently setup using 2G of memory.
Unfortunately the php-memory limit is still at 128mb.
How can i change these variables ?
(memorylimit / maxexecution_time / etc.)

Thanks :)

  • Hi @chhaaks

    You should be able to change those settings by creating a .user.ini file but rather then setting it in your repo’s root add it to your run command for that worker.

    Something like: echo 'memory_limit=512M' > .user.ini && heroku-php-apache2 should work to adjust that limit.

    Hope it helps!

    • Thanks for your reply.
      so if i wanted to run a php command afterwards, should i use it this way :

      echo 'memory_limit=512M' > .user.ini && heroku-php-apache2 
      php artisan horizon --timeout=3600 --memory 512

      or this way

      echo 'memory_limit=512M' > .user.ini && heroku-php-apache2 
      artisan horizon --timeout=3600 --memory 512

      Thanks again :)

      I tried it the last way and when i use the console and run php -i | grep "memory_limit" i still get 128m :(