使用PHP脚本运行shell命令 [英] Running shell commands using PHP script
本文介绍了使用PHP脚本运行shell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用CodeIgniter创建一个应用程序,但是我无法使用我的PHP脚本运行Linux命令。
如何运行终端命令? p>
我尝试过 shell_exec()
和 exec()
,但两者在使用CI时不起作用。
解决方案
这取决于您的服务器配置如果功能被禁用,以在 php.ini
中启用它们。以下是一些替代方案:
-
popen()
- 或如果您需要互动方式,请尝试
proc_open()
-
system()
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.
解决方案
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()
这篇关于使用PHP脚本运行shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文