1

Trying to configure PHP to perform a core dump, I executed the following:

[root@myserver ~]# echo '/tmp/core-%e.%p' > /proc/sys/kernel/core_pattern
[root@myserver ~]# echo 0 > /proc/sys/kernel/core_uses_pid
[root@myserver ~]# ulimit -c unlimited

I do not know what the original ulimit values were, but they are now as follows:

[michael@myserver ~]$ ulimit
unlimited
[michael@myserver ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 7867
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 4096
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
[michael@myserver ~]$

I also made some changes to the php-fpm config files, but already changed them back to their default settings.

I am running Centos7. What should I set ulimit values back to? Also, should I do anything to reverse the two echo commands?

2 Answers 2

1

That looks like the default values to me. If you changed them using the CLI, the changes are not permanent. You can restart the session and they will revert to the original values.

Similarly, proc changes are not permanent; a reboot will reset them.

0

You are changing the ulimit of the shell you are logged in with if you run “ulimit -c 0” and not the php-fpm service.

You need to add a “LimitCORE=infinity” to the service that starts the php-fpm service if you want it to be permanent. See the systemd documentation for more details.

To do this, you’d run (as root) “systemctl edit php-rpm.service”, and an editor will come up, where you would add something like this:

[Service]
LimitCORE=infinity

(or use a sensible core size limit like 1G)

To preserve the core_pattern, you need to disable systemd-coredump and abrtd, and set the kernel.core_pattern via a sysctl file in /etc/sysctl.d/.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.