I have modules written in python. And I am running my webserver through php apache server. For invoking the existing python scripts, I'm using the following command and this works fine,
shell_exec("python.exe file.py args");
Is there a proper way apart fro doing shell_exec / exec comnand from php.
There are two ways to do that.
Integrate Python into PHP. PHP supports C extensions while Python has libpython. I do not know if such extension exists. This approach doesn't require additional processes to start, but it is total madness.
Run Python script as a service and instead of shell_exec()
call some REST API (or whatever). This approach requires additional entities such as services, sockets, but it seem to be architecturally correct.