Running shell commands using PHP script

[亡魂溺海] 提交于 2019-12-31 03:53:06

问题


I'm creating an app using CodeIgniter, but I'm unable to run Linux commands using my PHP script.

How do I run terminal commands?

I've tried shell_exec() and exec(), but both don't work while using CI.


回答1:


That depends on your server configuration if the functions are disabled, you need to enable them in your php.ini. Here are some alternatives:

  • popen()
  • or if you need an interactive way try proc_open()
  • system()


来源:https://stackoverflow.com/questions/16240411/running-shell-commands-using-php-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!