I'm trying to call an executable .exe
(a location is added in the PATH
of WINDOWS
) within a controller
in Laravel
using the methods escapeshellarg
and exec
of the next Form:
$escaped_cmd = escapeshellarg('C:\wamp64\www\proyecto\app\Http\Controllers\openalpr_64\alpr.exe samples\us-4.jpg');
$salida=exec($escaped_cmd);
return $salida;
and it does not give me anything back. When I print the variable $escaped_cmd
it returns exactly the same as it is being entered and I paste it directly to CMD
I get this correctly.
C:^\wamp64^\www^\proyecto^\app^\Http^\Controllers^\openalpr_64^\alpr.exe samples^\us-4.jpg
plate0: 10 results
- LTM378 confidence: 89.5721
- LM378 confidence: 83.0723
- LTM37B confidence: 81.7983
- LTH378 confidence: 76.4686
- LTN378 confidence: 76.053
- LM37B confidence: 75.2985
- LH378 confidence: 69.9688
- LN378 confidence: 69.5532
- LTH37B confidence: 68.6948
- LTN37B confidence: 68.2792
Also, the exec()
method works very well, since it correctly returns the exec('ipconfig') ;
and the exec('echo hola mundo');
Much less returns error by browser console. What can it be?