我有一个小小的PowerShell脚本来获取远程磁盘空间并将其保存到Postgre数据库的表中。exec('script.ps1')返回错误,cmd> scrtipt.ps1运行成功
如果我在windows cmd上执行命令,它会运行成功。
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\xampp\....\skripts\getDiskSpace.ps1 -Command -arg 192.168.178.178
但是,如果使用PHP exec()函数,我得到一个ODBC错误
exec("C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -File C:\\xampp\\....\\skripts\\getDiskSpace.ps1 -Command -arg 192.168.178.178", $output);
如果我使用PHP escapeshellarg()函数,EXEC的$()输出为NULL
$输出的内容是:
[微软] [ODBC驱动程序管理器]数据源名称未找到,没有 指定默认驱动程序
我不知道为什么,我
$conn = New-Object System.Data.Odbc.OdbcConnection
$conn.ConnectionString = "Driver={PostgreSQL Unicode(x64)};Server=$dbServer;Port=5432;Database=$dbName;Uid=$dbUser;Pwd=$dbPass;"
PostgreSQL的64位ODBC指定的ODBC驱动程序驱动程序已安装!
我在Windows 2008 SP2 Enterprise Server上的工作......(想找回一个Linux Web服务器:d ...)
有这样的人的问题?或者知道解决方案?