Serving large files with PHP

前端 未结 9 1001
北海茫月
北海茫月 2020-12-13 07:51

So I am trying to serve large files via a PHP script, they are not in a web accessible directory, so this is the best way I can figure to provide access to them.

The

9条回答
  •  渐次进展
    2020-12-13 08:33

    If your files are not accessible by the web server because the path is not in your web serving directory (htdocs) then you can make a symbolic link (symlink) to that folder in your web serving directory to avoid passing all traffic trough php.

    You can do something like this

    ln -s /home/files/big_files_folder /home/www/htdocs
    

    Using php for serving static files is a lot slower, if you have high traffic, memory consumption will be very large and it may not handle a big number of requests.

提交回复
热议问题