php - CodeIgniter - 消息 : mkdir(): Permission denied on Ubuntu

标签 php codeigniter file-permissions mkdir

我需要一些帮助。我的 Post_model 构造函数中有这个 PHP 脚本

$dir = FCPATH . 'uploads' . DIRECTORY_SEPARATOR . 'posts'; 
if (!is_dir($dir)) {
    mkdir($dir, 0755, true);
} 

这向我显示了这个错误:

Severity: Warning

Message: mkdir(): Permission denied

主要思想是该项目能够创建用户,这些用户可以上传图像,或创建存储在上传文件夹中的文件夹相册。

最近几天我一直在努力修复这个错误,但找不到解决方案。我已经在 Windows 上尝试过这段代码,效果很好,但在 Linux (Ubuntu 14.04) 上不行

最佳答案

请尝试 chmod 777 -R 。在你的目录中

关于php - CodeIgniter - 消息 : mkdir(): Permission denied on Ubuntu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32861261/

相关文章:

php - 如果 URL 上有值,则在创建后更改 <select> 的选定值(通过 PHP)

php - 在不向用户发送电子邮件的情况下重置密码

php - ACL(访问控制列表)Codeigniter 按用户 ID 而非角色

c# - 移动后正确设置文件的权限

php - 重定向回来之前暂停页面

javascript - 脚本和 css 未加载到 Web 服务器中

codeigniter - Codeigniter 3 中的错误 ‘Your config file does not appear to be formatted correctly.’ 消息

C# treeview 未经授权的异常

检查 C/*nix 中指定用户的文件访问权限

PHP VS。 HTML。将值从 html 传递到 php