mkdir():Ubuntu 14.04上XAMPP中的权限被拒绝

时间:2015-01-24 15:32:27

标签: php apache ubuntu xampp mkdir

我尝试执行此代码以在userdata / profile_pics中创建一个文件夹:

$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
   $rand_dir_name = substr(str_shuffle($chars), 0, 15);
   mkdir("userdata/user_photos/$rand_dir_name");

但它会出现以下错误:

Warning: mkdir(): Permission denied in /opt/lampp/htdocs/findfriends/account_settings.php on line 88

如何使代码有效?

1 个答案:

答案 0 :(得分:-2)

您必须使用写权限为user_photos设置permsissions .. https://help.ubuntu.com/community/FilePermissions