现在的位置: 首页 > 综合 > 正文

11、如何执行cgi中的system命令

2011年01月02日 ⁄ 综合 ⁄ 共 585字 ⁄ 字号 评论关闭

1、本地可以运行system命令,可是通过cgi调用时却不执行,没有执行cgi中重定向命令。初始分析出是权限问题。

2、解决方法:

1)给cgi加权限

chmod +s my.cgi

2)配置apache以使其可执行cgi

<IfModule !mpm_netware_module>

<IfModule !mpm_winnt_module>

# If you wish httpd to run as a different user or group, you must run

# httpd as root initially and it will switch.

# User/Group: The name (or #number) of the user/group to run httpd as.

# It is usually good practice to create a dedicated user and group for

# running httpd, as with most system services.

User daemon

Group daemon

</IfModule>

</IfModule>

重启apache

/usr/local/apache2/apachectl -k restart

3)给所在的目录加权限

参考

1】 关于权限,有比较好的引用

http://www.cnblogs.com/mydomain/archive/2011/09/28/2194048.html

抱歉!评论已关闭.