PHP exec(),shell_exec(),system(),passthrough()函数是否还有其他选择? [英] Is there any alternative for PHP exec(), shell_exec(), system(), passthrough() functions?

查看:87
本文介绍了PHP exec(),shell_exec(),system(),passthrough()函数是否还有其他选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP exec(),shell_exec(),system(),passthrough()函数是否还有其他选择?由于所有这些功能都有安全风险,因此需要一种无需使用任何这些功能即可执行服务器命令的方法.

由于安全原因,无法在我的服务器php配置中启用这些功能.但是根据网站的要求,我需要通过php脚本执行一些外部命令,例如服务器ssh命令.因此,如果有其他方法可以实现这一目标,请回复给我.

解决方案

您可以编写shell或bash脚本,并通过cron调用它们,或者设置一个守护程序,如果可以的话,让它检查数据库中的特定标志. /p>

Is there any alternative for PHP exec(), shell_exec(), system(), passthrough() functions? As all these functions have security risk, need a way to execute server commands without using any of these functions.

Due to security reasons, can't enable these functions on my server php configuration. But as per website requirement, I need to execute some external commands like server ssh commands through php script. So, if there are any alternative ways to achieve same then please reply back to me.

解决方案

You can write shell or bash scripts and invoke them through cron or set a daemon and let it check for a specific flag in database if you can do that.

这篇关于PHP exec(),shell_exec(),system(),passthrough()函数是否还有其他选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆