PHP 128K command line limit

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
ohitz
Posts: 1
Joined: Mon Sep 26, 2016 9:21 am

PHP 128K command line limit

Post by ohitz »

Hi all

I stumbled into an issue with a graph which has several 100 graph items. graph_image.php generates an empty file, no error message whatsoever.

I have traced this down to the command line being too long. It appears that PHP's popen() command refuses to work as soon as the command line reaches 128K. The same is true for other PHP commands such as exec() or passthru(). When I execute the same command line in a shell, the command is executed properly, so I gather this is really a limitation in PHP.

Code: Select all

exec("echo ".str_repeat("-", 128*1024-6), $out, $rc);
-> works as the command line is 131071 (128K-1), $rc is 0

exec("echo ".str_repeat("-", 128*1024-5), $out, $rc);
-> works as the command line is 131072 (128K), $rc is 127
Has anybody else already run into this?

By the way, this is on Linux. I have tried different versions of PHP.

Best regards

Oliver
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests