douwei1128 2016-10-20 10:23
浏览 43

使用PHP通过CMD启动pg_restore不起作用

I try to restore a database (".backup" file) with pg_restore with cmd launch with PHP code but it doesn't work.

1- I give to my PHP variable all the cmd code

$cmd="cmd /c C:/Program Files/PostgreSQL/9.1/bin/pg_restore.exe -d ".$_POST['data2']." -i -h localhost -p 5432 -U ********** D:/backup/voirie.backup";

2- I launch it

exec($cmd);

My php work without result

enter image description here

On my server the process is launched

enter image description here

Other informations

  • In place of exec() I tested with system() and passthru()
  • I tested to create a batchfile from my php. This batchfile, work fine when launch him on the server but not from my PHP file
  • The generate code in $cmd was tested directly from CMD on the server and it works
  • For other codes on this server I use this who work fine: system("cmd /c C:/Python35-32/python.exe D:/python/serpent.py");
  • I tested with this quotes without result : $cmd='cmd /c "C:/Program Files/PostgreSQL/9.1/bin/pg_restore.exe" -d '.$_POST['data2'].' -i -h localhost -p 5432 -U ********** D:/backup/voirie.backup';
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容