伺服器禁用了chmod(),怎麼解決

來源:互聯網
上載者:User
伺服器禁用了chmod()函數
上傳檔案連讀的許可權都沒有
假設不改伺服器配置,在程式裡,有沒有解決的辦法


回複討論(解決方案)

聯絡伺服器管理員,給你的網站程式目錄單獨設定 相關許可權

樓上肯定看得太快了
我想問的是,程式裡有沒有解決辦法

上傳檔案預設是apache的許可權,一般為www-data是擁有者。
查看phpinfo(); 看看disable_functions是否有chmod,如果是就是被屏蔽了。
如果chmod不在disable_functions,則表示沒有屏蔽,應該是可以使用的。

www-data上傳檔案,自己就是擁有者,不可能沒有許可權的。
起碼php是有許可權讀寫的。

www-data上傳檔案,自己就是擁有者,不可能沒有許可權的。
起碼php是有許可權讀寫的。



1、chmod()是被禁用了的
2、檔案上傳後,許可權如:(如果說有許可權,難道是我php代碼寫得有問題嗎?)

擁有者不是可以rw嗎?
看看擁有者是什嗎?

許可權最起碼設定為多少,瀏覽器訪問時才能正常瀏覽?

window下測試時上傳的圖片,放到linux後是 -rw-r--r-- 許可權
這種可以正常訪問

用 ftp 軟體查看並修改 images 目錄的許可權

用 ftp 軟體查看並修改 images 目錄的許可權


images之前是755,現在改成777也還是不行
上傳的圖片檔案的許可權都是-rw-------

改成 666

改成 666


改成666也不行的。現在的問題應該是在檔案的許可權上

9月2號之前是win環境上傳的,沒有問題
5號之後上傳到linux空間,就沒讀取許可權
另外,linux下php檔案上傳,預設是 -rw------- 嗎?

擁有者是什嗎?

擁有者是什嗎?


是不是得進入linux系統才能看到擁有者?
正常情況下,上傳檔案的擁有者是誰呢

/** 擷取檔案或檔案夾的擁有者,組使用者,及許可權 * @param  String $filename * @return Array */  function file_attribute($filename){        if(!file_exists($filename)){          return false;      }        $owner = posix_getpwuid(fileowner($filename));      $group = posix_getpwuid(filegroup($filename));      $perms = substr(sprintf('%o',fileperms($filename)),-4);        $ret = array(          'owner' => $owner['name'],          'group' => $group['name'],          'perms' => $perms      );        return $ret;    } 

/** 擷取檔案或檔案夾的擁有者,組使用者,及許可權 * @param  String $filename * @return Array */  function file_attribute($filename){        if(!file_exists($filename)){          return false;      }        $owner = posix_getpwuid(fileowner($filename));      $group = posix_getpwuid(filegroup($filename));      $perms = substr(sprintf('%o',fileperms($filename)),-4);        $ret = array(          'owner' => $owner['name'],          'group' => $group['name'],          'perms' => $perms      );        return $ret;    } 


不愧是萬網
Warning: posix_getpwuid() has been disabled for security reasons in ............
Array ( [owner] => [group] => [perms] => -600 )

屏蔽得真多。

??是600?限。都已?可以??檔案了。真是怪。

還是沒弄好,還是出現Warning: chmod() has been disabled for security reasons in /data/home/qyu1297580001/htdocs/product/admin/func/upload.inc.php on line 66
OK這個求解

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.