I want to call PHP script from my Python script
I have this code
subprocess.run(['php', "script.php", long_string], stdout=subprocess.PIPE)
but I am getting error
OSError: [Errno 7] Argument list too long: 'php'
I have read online threads that I should always use subprocess.run
for Python 3+
I have also tried
subprocess.run(['ulimit', '-s', 'unlimited', 'php', "script.php", long_string], stdout=subprocess.PIPE, shell=True)
But then I get
OSError: [Errno 7] Argument list too long: '/bin/sh'
My string is 141,664 characters = 141,706 bytes
and that can get larger too
What should I do? How to surpass length error for my Python script?
My uname -a
output is
Linux mani 2.6.32-042stab123.9 #1 SMP Thu Jun 29 13:01:59 MSK 2017 x86_64 x86_64 x86_64 GNU/Linux