首页 >php教程 >php手册 >Warning:chmod() has been disabled for security reasons in

Warning:chmod() has been disabled for security reasons in

WBOY
WBOY原创
2016-05-25 16:41:241661浏览

Warning: chmod() has been disabled for security reasons in D:\freehost\xxx\WindFile.php on line 102根据英文的意思我们知道是出于安全原因,已被禁用的chmod()了,那么解决办法就是很简单了,直接把chmod()禁用关了就可以了.

如果你有服务器权限操作方法很简单打开PHP.INI,找到这行:

disable_functions =

在后面那里加上要禁用的函数,如禁用多个函数,要用半角逗号分开,给个例子,代码如下 :

disable_functions = passthru,exec,system,popen,chroot,scandir,chgrp,chown,escapesh 
ellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status

如果没有服务器权限,就只能从程序下手了,下面我以ecmall出现此问题的解决办法.

第一步:找到eccore/controller/message.base.php,将如下代码:

if ($errno == 2048) 
{ 
    return true; 
}

//替换为: 

if ($errno == 2048 || (($errno & error_reporting()) != $errno)) 
{ 
    //不再需要通过_at方法来抵制错误 
    //错误被屏蔽时就不抛出异常,该处理就允许你在代码中照常使用error_reporting来控制错误报告 
    return true; 
}

第二步:找到eccore/ecmall.php,代码如下:

function _at($fun) 
{ 
    $arg = func_get_args(); 
    unset($arg[0]); 
    restore_error_handler(); 
    $ret_val = @call_user_func_array($fun, $arg); 
    reset_error_handler(); 
    return $ret_val; 
}

//修改为 

function _at($fun) 
{ 
    $arg = func_get_args(); 
    unset($arg[0]); 
    $ret_val = @call_user_func_array($fun, $arg); 
    return $ret_val; 
}

有些危险函数我们尽量在开发时就为避免掉了,免得以后要改,下面我列出一般服务器会禁止使用的函数有如下:

disable_functions = system,exec,shell_exec,passthru,proc_open,proc_close, proc_get_status,checkdnsrr,getmxrr,getservbyname,getservbyport, syslog,popen,show_source,highlight_file,dl,socket_listen,socket_create,socket_bind,socket_accept, socket_connect, stream_socket_server, stream_socket_accept,stream_socket_client,ftp_connect, ftp_login,ftp_pasv,ftp_get,sys_getloadavg,disk_total_space, disk_free_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn