在wamp服务器中启用shell_exec() [英] Enable shell_exec() in wamp server
问题描述
最近我在wamp服务器上传递了一个问题.我需要在PHP中使用shell_exec()
函数来运行一些外部shell脚本(一些校验和文件).但是在我的wamp服务器中,默认情况下该功能处于禁用状态.我在Google中搜索,但找不到解决方案.因此,我尝试将这些代码放入实时服务器中.但是也有同样的问题.我联系了该服务器的技术人员,但他说我们无法启用shell_script.这是安全暴力.
Recently I have passed one issue on wamp server..I need to use the shell_exec()
function in PHP for running some external shell script (some checksum file) . But in my wamp server the function is disabled by default. I searched in google but I cant find out the solution. So I try to put that code in live server. But there's also the same problem. I contacted the technical person for that server but he said we cant enable shell_script. It is security violence.
所以唯一的办法是在wamp服务器中尝试...如何启用 shell_exec()
或exec()
..
推荐答案
以下一行是我读过的最好的该问题:您需要在\ Apache2 \ bin文件夹中的php.ini中禁用安全模式,而不是php文件夹.请在加载新设置后立即重新启动Apache2服务."
The following line was the best I read to this problem: "You need to disable safe mode in the php.ini located in the \Apache2\bin folder, not the php folder. Restart Apache2 service right after to load the new settings."
解决方案是:
-
停止Wamp-Server的所有服务并关闭程序
stop all services from Wamp-Server and close the programm
打开.../wamp/bin/apache/Apache2../bin/php.ini
Open .../wamp/bin/apache/Apache2../bin/php.ini
将php.ini复制到桌面并打开
copy php.ini to desktop and open it
设置 safe_mode_exec_dir (=后的行为空,因此它处于打开状态!!)将其设置为关闭!
set safe_mode_exec_dir (line after = is empty, so IT IS ON!!!) set it off!
保存
复制回目录(也许您需要管理员权限)
copy back to dir (maybe you need admin rights)
启动wamp-server
start wamp-server
享受exec()和合作伙伴.
enjoy exec() and co.
这篇关于在wamp服务器中启用shell_exec()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!