I've never delt with this too much, know how to accomplish it, but want to know best method:
What is the best method to pass some values to a compiled program (c++) and retrieve its results in PHP?
Specifics are a Lamp environment (CentOS), running with cPanel. I have a client who has a "super secret calculation", and they want it so if someone hacked the site, unlike a PHP script, they can't just view the PHP code to see how it calculates this (yeah, ignoring the idea of decompilers for this discussion)
Thanks for advice on it.
-Greg
Most efficent way to call to a program
Moderator: General Moderators
Re: Most efficent way to call to a program
My vote goes to the proc functions, proc_open and proc_close being the most useful. Gives you a ridiculous amount of control over how to execute a command.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Most efficent way to call to a program
exec() is probably the easiest. It allows you to get the output of the program in a var.
(#10850)
Re: Most efficent way to call to a program
Thanks, I knew of exec, just wasn't sure which was most efficient. About the only thing I have really used before was system to call ImagMagik (convert) for image resizing.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Most efficent way to call to a program
I really don't know "which was most efficient." My guess is that there is very little call overhead difference between proc_open(), exec() and the other system functions.
(#10850)