dqrsceg6279196 2014-11-25 20:16
浏览 30
已采纳

如何给symfony权限写

I have here a form that is uploading a photo. Initially I got an error because symfony couldn't create the direcotry so I created them manualy.

Now I get this error:

Unable to write in the "/home/crixi/projects/symfony/src/Acme/TestBundle/Entity/../../../../web/uploads/picture" directory 

I'm using ubuntu.

Is there any settings that I should to to assign symfony the righs to write in that folder?

  • 写回答

1条回答 默认 最新

  • douxin8383 2014-11-25 21:00
    关注

    If you are using Ubuntu, then your web user will be www-data, not apache. So that's why it wouldn't work when you changed the apache permissions. You can do this properly by doing the following:

    1. sudo chgrp -R www-data /home/crixi/projects/symfony/web/uploads
    2. sudo chmod -R g+rwx /home/crixi/projects/symfony/web/uploads

    This will allow the web user (www-data) the proper permissions to write to your upload dir and subdirs. This is better than giving everyone write permissions because it's always good to do things right in the dev env so you don't have issues when going to prod.

    OR, as @Wrikken suggests, just use chown like so:

    sudo chown -R www-data /home/crixi/projects/symfony/web/uploads

    It just depends how you want to manage your permissions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器