dpruwm6206 2018-10-09 14:01
浏览 242

通过.BAT执行PHP文件

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.

DIRECTORY: directory listing

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 iOS开发关于快捷指令截屏后如何将截屏(或从截屏中提取出的文本)回传给本应用并打开指定页面
    • ¥15 unity连接Sqlserver
    • ¥15 图中这种约束条件lingo该怎么表示出来
    • ¥15 VSCode里的Prettier如何实现等式赋值后的对齐效果?
    • ¥15 流式socket文件传输答疑
    • ¥20 keepalive配置业务服务双机单活的方法。业务服务一定是要双机单活的方式
    • ¥50 关于多次提交POST数据后,无法获取到POST数据参数的问题
    • ¥15 win10,这种情况怎么办
    • ¥15 如何在配置使用Prettier的VSCode中通过Better Align插件来对齐等式?(相关搜索:格式化)
    • ¥100 在连接内网VPN时,如何同时保持互联网连接