Hello everyone,
I'm starting to go crazy looking for an answer. Is it possible to execute multiple commands from php using the exec() function?
Here is an example, I have an executable file, driv_calc.exe. When I execute that file, it prompts me with a series of options to choose from. So i'll enter 4 for option 4. Then the program will prompt me with another list and so on and so forth.
Can I perform this same task in php? If so, how? If not, why not?
Thanks
Exec multiple comands
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Exec multiple comands
Only if the executable can run without user interaction with some command line args, such as: driv_calc.exe 4 2 1 4
You may be able to get this functionality using proc_open() or maybe popen().
You may be able to get this functionality using proc_open() or maybe popen().
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
-
papa_smurf
- Forum Newbie
- Posts: 14
- Joined: Tue Jun 01, 2010 12:22 pm
Re: Exec multiple comands
Unfortunately it does require user interaction in its current form. So basically files that are run using the exec function can only run properly if they can operate without user interaction during the process?
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Exec multiple comands
Yes, so check out proc_open() though it is quite a chore especially if you're not familiar with the process. I would search for a proc_open() tutorial and/or look at the comments on the manual page.papa_smurf wrote:Unfortunately it does require user interaction in its current form. So basically files that are run using the exec function can only run properly if they can operate without user interaction during the process?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.