Skip to content
Advertisement

php exec function taking so much time

i want to run node js in my php code with exec function, but why when i’m running the exec function it’s not showing anything. but when i’m running the node js in terminal as usual it running as normal.

index.js

JavaScript

php code

JavaScript

Advertisement

Answer

This is because exec() is using output buffering, which means all output is only returned after it finished.

You could try to use passthru instead, which will probably return your output immediately.

https://www.php.net/manual/en/function.passthru.php

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement