Warning: chmod() has been disabled for security reasons in_PHP教程

來源:互聯網
上載者:User
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

http://www.bkjia.com/PHPjc/629637.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/629637.htmlTechArticleWarning: chmod() has been disabled for security reasons in D:\\freehost\\xxx\\WindFile.php on line 102根據英文的意思我們知道是出於安全原因,已被禁用的chmod()...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.