I am using the exec()
function in PHP to run a command via command prompt. However the time which is needed to process this command using PHP is much longer compared to when I actually run the command on the CLI.
Any idea how I can improve its performance or make more efficient calls? I am trying to run powershell scripts.
The exec()
function needs to create another process, a virtual shell, run the command, wait for the reply, and then return with the results, if any.
That’s the sort of thing you can expect whenever you want PHP, or some other platform, to communicate outside of itself.
There are the following alternatives:
exec
to call another program, such as ImageMagick, there may be an interface available to PHP directly.Other than that, maybe not.