I'm going crazy with this...
I'm trying to execute electron-pdf to generate some PDFs from a PHP application (using Laravel) and PHP 7.0.23.
When running the app with "php artisan serve", which uses php-cli, running the following works fine and generates my PDF:
shell_exec("electron-pdf $inputURL $outputFile");
When serving the app though nginx (using php-fpm) this command does nothing.
So I went to debug this issue...
I've tried to run shell_exec("node -v")
but it didn't run when under php-fpm, so I've noticed that the PATH that php-fpm uses is not that of the user defined in the pool, so I've defined the env[PATH]
variable and now php-fpm sees the correct path, the same path that php-cli uses.
Now if I call shell_exec("node -v")
I see v8.4.0
in both cli and fpm. So I thought that all was fine!
I then tried shell_exec("electron-pdf --version")
and... it prints fine on cli but does nothing on fpm...
How can I debug this? What's happening? How can it be that php-cli and php-fpm, running as the same user, with the same path, have different behaviors?
Thanks a lot, if you need further info I'll edit the question accordingly since I don't have enough reputation to comment.
PS: chroot is disabled, secure mode is off, shell_exec is not in the disable_functions