N
N
NaN2015-03-23 11:05:51
PHP
NaN, 2015-03-23 11:05:51

How to increase php stack size (>8192)?

there is a bunch of ubuntu 14.04 + nginx (openresty) + php-fpm
32 gb memory , you
need to increase pcre.recursion_limit, and accordingly the default stack is not enough for heavy pcre.
Let's say php workers run as user phpuser
Let's get started:
/etc/security/limits.conf

phpuser - stack -1
root - stack -1

// -1 = unlimited
~ # su phpuser --shell /bin/bash --command "ulimit -s"
unlimited

All OK.
service php5-fpm restart
<?php 
echo shell_exec('ulimit -s'); 
// 8192
?>

Well, respectively, deep and heavy preg_ fall into the
WTF segfault, gentlemen, who knows? Why doesn't php track the stack size?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
NaN, 2015-03-23
@NaN

Guys!
recursion_limit is not the stack size .
php.net/manual/ru/pcre.configuration.php
---
The solution so far is this: Elbek Azimov
has : on Debian limits.conf * - stack -1 @* - stack -1 & add at the end of /etc/pam. d/common-session session required pam_limits.so ---- I have: Ubuntu 14.04 Lts 64 minimal via /etc/init.d/php5-fpm Commented out the if init_is_upstart; Added to do_start() ulimit -s unlimited removed old update-rc.d -f php5-fpm remove removed /etc/init/php5-fpm.conf updated update-rc.d php5-fpm defaults

A
Anton, 2018-06-04
@antonio1107

In php version > 7.0 disable pcre.jit=0 and it will work.
Enabled by default pcre.jit=1

H
He11ion, 2015-03-23
@He11ion

cat /etc/php.ini | grep recursion_limit
have you tried?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question