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

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

WBOY
Release: 2016-05-25 16:41:24
Original
1671 people have browsed it

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

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

disable_functions =
Copy after login

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

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

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

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

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

//替换为:

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

第二步:找到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; 
}
Copy after login

//修改为

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

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

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
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template