[英]Running shell commands using PHP script
I'm creating an app using CodeIgniter, but I'm unable to run Linux commands using my PHP script. 我正在使用CodeIgniter创建应用程序,但是无法使用PHP脚本运行Linux命令。
How do I run terminal commands? 如何运行终端命令?
I've tried shell_exec()
and exec()
, but both don't work while using CI. 我已经尝试过shell_exec()
和exec()
,但是在使用CI时都无法正常工作。
That depends on your server configuration if the functions are disabled, you need to enable them in your php.ini
. 如果功能被禁用,那取决于您的服务器配置,您需要在php.ini
启用它们。 Here are some alternatives: 以下是一些替代方案:
popen()
proc_open()
或者如果您需要交互方式,请尝试proc_open()
system()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.