I am trying to create an installer by executing a PHP file via a Bat file on windows. The PHP file then imports a DB at some stage along with some other installations.
I have been able to do it with other files but no matter what I do on this particular file it always gives me this error:
.BAT FILE
@echo on
"C:\uwamp\bin\php\php-7.0.3\php.exe" -f "C:\Program Files\Asset\install\importdb.php"
pause
ERROR MESSAGE:
C:\Program Files\Asset\install>"C:\uwamp\bin\php\php-7.0.3\php.exe" -f "C:\Program Files\Asset\install\importdb.php"
The system cannot find the file specified.
PHP FILE:
<?php
$restore_file = "C:\Program Files\Asset\install\asset.sql";
$server_name = "localhost";
$username = "root";
$password = "root";
$database_name = "asset";
$cmd = "mysql -h {$server_name} -u {$username} -p{$password} {$database_name} < $restore_file";
exec($cmd);
?>
The behavior is strange because I have another 2 BAT files running the same code executing different PHP files from the exact same directory.