PHP exec () not working - early? No mistake?

I am using PHP to run exec () in a script that looks like this:

exec("pdftk xx.pdf fill_form xx.fdf output xx.pdf flatten");

The strangest thing is that when I enter ssh and insert the command manually, it works fine! it outputs 224k pdf. but when I use the exec () command, only the first 36k from the script is issued. (I checked - the first 36k of a good file is identical to a bad file)

no heres the weird thing - this worked fine with exec () until I added a few more variables to the fdf file, making it longer. I thought this was a problem with fdf due to new data - but why would this process work fine with ssh?

update: I also tried running php -f test.php (which only had one exec line). which output the entire file properly. but even if I go to http://mydomain.com/test.php , I get only part of the file.

the script does not sync because I echo it after the exec () command and it works fine.

it cannot be a permission issue (ssh registers as root) as it is still able to write the file

also - when I try to get return or exit value from exec or passthru, I get nothing. the return value is always 0.

update: in apache error logs I get

[Fri Sep 17 20:00:57 2010] [error] Unhandled Java exception: [Fri Sep 17 20:00:57 2010] [error] java.lang.OutOfMemoryError [Fri Sep 17 20:00:57 2010] [error ] <>

php_ini 32M 64M - . , , , . PHP ? -?

!

+3
3

, . Apache RLimitMEM conf, . . 89 , , , .

+1

, -, : php.ini, exec() (, ), - , , exec, , , PHP.

0

update: apache,

[ 17 20:00:57 2010] [] Java: [ 17 20:00:57 2010] [] java.lang.OutOfMemoryError [ 17 20:00:57 2010] [error] < >

, apache java-? ? .

i php_ini 32M 64M - . , , , . PHP ? -?

, - , , pdftk, ? pdftk ? , ?

- ? http://www.wallpaperama.com/forums/how-to-change-memory-limit-php-apache-server-t53.html

update: php -f test.php( exec ). . http://mydomain.com/test.php .

, - (VPS) . ( -) (redis), predis php , redis (BLPOP/LPUSH), PHP- (php -f), , (pdftk).

0

Source: https://habr.com/ru/post/1765383/


All Articles