dtng25909 2010-04-09 12:27
浏览 49

FTP功能导致FTP中的所有者(99 99)?

I have a script (Joomla) that creates files and directories on the server. The problem is that it creates them under owner 99 99 (nobody) and after I can't delete or modify them by FTP without the help of the server admin.

I think that is move_uploaded_file function of php.

Is there any solution of this problem by the WHM or by the server admin? Can I modify the default owner in ftp?

  • 写回答

2条回答 默认 最新

  • dongtiao0657 2010-04-09 12:33
    关注

    The user that PHP runs under - nobody - is set by the system administrator. There's nothing you can do about that.

    You can try chown() to change the file's owner if you know the FTP user's ID. Usually though, you will not be allowed to do this from within PHP.

    Depending on the group situation on the server, it could be that if you use chmod to change the file's access rights after the file has been uploaded, the FTP account can access the file:

    Try this first:

    chmod($uploaded_file, 0660); // owner+group read+write
    

    If that doesn't work, try this:

    chmod($uploaded_file, 0666); // global read+write
    

    one of these should make the file usable by the FTP account.

    The 0666 is highly discouraged because other users on the server could write into your files, but in some configurations, it's the only way to get going.

    评论

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计