PHP   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了php shell_exec bash.exe在Window XP IIS中不起作用大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

generateb.PHP

 <?PHP
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
    echo 'This is a server using Windows!';
    $output = shell_exec("C:\\cygwin\\bin\\bash.exe --login -c C:\\cygwin\\bin\\MysqL2sqlite.sh -h 127.0.0.1 -u root -pApacheah64 db_shuttlebus tbl_driver tbl_location tbl_rate tbl_route tbl_routeid tbl_vehicle | C:\\cygwin\\sqlite3.exe  C:\\Inetpub\\wwwroot\\BusTicket\\exportdatabase\\database.sqlite");
    echo "<pre>".$output."</pre>";
} else {
    echo 'This is a server not using Windows!';
    $output = shell_exec("bash MysqL2sqlite.sh -h 127.0.0.1 -u root -pApacheah64 db_shuttlebus tbl_driver tbl_location tbl_rate tbl_route tbl_routeid tbl_vehicle | sqlite3  /var/www/BusTicket/exportdatabase/database.sqlite");
    echo "<pre>".$output."</pre>";
}

?>

这是输出错误

Warning: shell_exec(): Unable to execute 'C:\cygwin\bin\bash.exe --login -c
C:\cygwin\bin\MysqL2sqlite.sh -h 127.0.0.1 -u root -pApacheah64 db_shuttlebus tbl_driver  
tbl_location tbl_rate tbl_route tbl_routeid tbl_vehicle | C:\cygwin\sqlite3.exe 
C:\Inetpub\wwwroot\BusTicket\exportdatabase\database.sqlite' in   
C:\Inetpub\wwwroot\BusTicket\exportdatabase\generatedb.PHP on line 4 

如果我手动打开cmmand promt并运行命令运行正常,但是在PHP中时则无法运行.为什么?

我已检查PHP.ini安全模式已关闭,并且disable_functions =为空.

这是我的PHPinfo.PHP

这是我使用cmd.exe运行命令,它正在工作

解决方法:

了解IIS,可能有多种可能的解释.这是我在http://www.php.net/shell_exec上发现的

HTH.

大佬总结

以上是大佬教程为你收集整理的php shell_exec bash.exe在Window XP IIS中不起作用全部内容,希望文章能够帮你解决php shell_exec bash.exe在Window XP IIS中不起作用所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: