PHP CLI "Out of memory" error on VPS server running CentOS with cPanel

I'm running Symfony2.1 on a hosted virtual server running CentOS with cPanel. Everything runs fine except that I can no longer use Symfony CLI commands. I'm getting this:

Fatal error: Out of memory (allocated 20185088) (tried to allocate 71 bytes)

error (for example when I try to run php app/console cache:clear --env=prod or other useful Symfony commands).

I've used the same commands through the CLI for months without any problem until a few days ago when this error came out. I haven't been able to overcome this error since then.

I want to point out that this not a PHP memory_limit related error (see below), being an "Out of memory" error and not an "Allocated memory size" error.

The exact same commands run perfectly when added to a cron job (this is the temporary workaround I'm using now), meaning that the scripts themselves are not to be blamed.

What I've tried to do so far:

My question :

I've now run out of options. I contacted my host but they are as clueless as I am (a lot more really, they don't even know about Symfony). Is there anyone out there who experienced the same problem?

If, by any chance, the /usr/local/cpanel/etc/login_profile/limits.sh have gotten me close to the answer, what I am missing? Do I need to reboot the server or restart cPanel, instead of just re-logging to my account?

On a side note, is this something that might-be related to a WHM/cPanel update (as stated, everything was working perfectly on the command line until a few days ago)?

Thanks for any help, and sorry for the long question.

PS: I've found other similar questions on Stack Overflow, but each of them was solved using one of the things I've already tried. So I guess I'm experiencing a different problem.

Upvotes: 9

Views: 2097

Answers (1)

It turns out that following an unwanted cPanel update my SSH port was changed from the default value and I was unable to login. I restarted SSH in safe mode in order to login.

Today, on a hunch, I looked at the SSH port in /etc/ssh/sshd-config, restarted SSH in "normal" mode, and logged in with the correct port: the scripts now run perfectly.

So the cause was using SSH in safe mode, just that. Hopefully this very specific problem will be useful to someone else: never use SSH safe mode for daily use unless you absolutely need to.

Upvotes: 1

Related Questions