繁体   English   中英

shell_exec未在php中执行命令

[英]shell_exec not executing command in php

我正在尝试从Windows计算机运行此命令,但无法使其正常工作。 当我将其输入命令提示符时,该命令可以正常运行,但是当我执行PHP脚本时,该命令却无法正常运行。

$command = '"C:\Program Files (x86)\WinSCP\winscp.exe" /console /command "open client" "cd /var/www/html/reports" "put C:\wamp\www\client\test.php" "exit"';
shell_exec($command);

尝试使用exec()可以帮助您进行调试。

<?php
$command = '"C:\Program Files (x86)\WinSCP\winscp.exe" /console /command "open client" "cd /var/www/html/reports" "put C:\wamp\www\client\test.php" "exit"';
$cmd = exec($command, $arr, $opt);

// Output info run from the command:
var_dump($cmd, $arr, $opt);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM