程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> Warning: chmod() has been disabled for security reasons in

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

編輯:關於PHP編程

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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved