Skip to main content

PHP CLI Memory Limit

Comments

3 comments

  • cPRex Jurassic Moderator
    Hey there! When you're on the command line and running PHP, it will use the system default. For example, I see this on a test machine where PHP 5.6 is the default for all accounts: root@host [/]# which php /usr/local/bin/php root@host [/]# /usr/local/bin/php -v PHP 5.6.40 (cli) (built: Nov 4 2020 10:02:45)
    Since that is the case, the PHP limits for that version would be applied to command line processes as well. If you're not seeing that happening just let me know.
    0
  • eric-cs
    Yes, but I want the CLI memory limit to be different than the PHP process running in FPM. Basically, I want unlimited memory limit for CLI processes since I am running some CLI tasks within Laravel which can be high memory usage. It seems this isn't really supported or I just don't know how to be able to set them to be different values. Most default PHP installations on Linux usually allow for a different CLI ini config, but that doesn't seem to be the case for WHM/CPanel at least not out of the box or obvious to me. Thanks
    0
  • cPRex Jurassic Moderator
    Thanks for the clarification. For the local script you're working with, could you add an "ini_set" value like this? ini_set('memory_limit','512M')
    That's the only thing I can recommend that may work, as there isn't a supported way to do that directly in PHP that I am aware of.
    0

Please sign in to leave a comment.