douran9707 2012-06-11 15:49
浏览 74

Mp3流媒体/下载网站 - apache服务器内存问题

I have a website, in which users can upload mp3 files (uploadify), stream them using an html5 player (jplayer) and download them using a php script (www.zubrag.com/scripts/).

When a user uploads a song, the path to the audio file is saved in the database and i'm using that data in order to play and show a download link for the song. The problem that i'm experiencing is that, according to my host, this method is using a lot of memory on the server, which is dedicated.

Link to script: http://pastebin.com/Vus8SRa7

How should I handle the script properly? And what would be the best way to track down the problem? Any ideas on cleaning up the code?

Any help much appreciated.

  • 写回答

2条回答 默认 最新

  • dongmei9203 2012-06-11 15:58
    关注

    I would recommend storing your files on disk (named something random [check for collisions!] or sequential, without file extension, and outside of the doc root), and only store information in your DB. It's much easier to stream a file from disk this way than it is out of a database result.

    When you retrieve an entire file's contents out of a database result, that data has to be in memory. readfile() doesn't have this issue. Use headers to return the original file name when sending the file back to the client, if you wish.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度