I've got a number of mp4 video files in a folder. When I use scandir with a relative path, the files display correctly in the webpage and can be played.
Browser html looks like this.
<div class="box">
<video src="./mp4Files/video1.mp4" type="video/mp4" loop class="clip" controls
</video>
</div>
When I specify the full path of the file, scandir finds the files, the browser constructs the videos in a but the error appears - no video with supported format and MIME type found.
Browser html looks like
<div class="box">
<video src="/var/www/html/VideoRecTest/mp4Files/video1.mp4" type="video/mp4" loop
class="clip" controls></video>
</div>
btw, open_base_dir has no value when I do a phpinfo().
These are not webservers
htmlphpjavascriptThese are webservers
nginxapache2Your webserver's
vhostconfiguration will contain a path that is served as the root directory./var/www/html/becomes0.0.0.0/orexample.com/.When you then want to visit, for example
index.phpthe URI would be0.0.0.0/index.phpwhich uses/var/www/html/index.php.Your use-case here is configured at
/var/www/htmland thus giving a path of/var/www/html/VideoRecTest/mp4Files/video1.mp4would merely give an absolute path ofYour video would, however, be accessible perfectly fine just at
Since your
webserveris already configured to serve directories and files from the root directory/var/www/html.You also cannot traverse below the specified root directory.
0.0.0.0/../will translate to/var/www/html/and thus redirect back to0.0.0.0/.Note, the root directory can be changed in your vhost configuration. I use
/var/www/htmlas an example due to it being the default.