note 46459 deleted from function.exec by cmb
| From: | cmb@php.net | Date: | Sun, 24 Nov 2019 08:37:14 +0000 |
| Subject: | note 46459 deleted from function.exec by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213189@lists.php.net to get a copy of this message | ||
Note Submitter: php-contrib at i-ps dot net
----
I had a bit of trouble using exec with Windows when passing a parameter to a PHP script file. I
found I needed to create a Windows batch "wrapper" file to get the script file to accept
the optional argument.
1) PHP script file exists:
c:\www\script.php
2) PHP is installed in:
c:\www\php\
3) BAT file contains:
@c:\www\php\cli\php.exe c:\www\script.php %1
and is saved as:
c:\www\script.bat
4) Use exec statement from PHP:
exec("c:\www\script.bat $arg", $output);
If you want to pass more than one argument, carry on with %2, %3, %4, ..., ... in your BAT file.
Hope this helps somebody