Lee Loftiss
Lee Loftiss

Reputation: 3195

php access files outside of apache

I have a project where Red5 is recording videos. I need PHP to be able to access the videos and move them so they can be accessed by HTML.

How can I do this?

I found this post: Accessing files outside the document root with Apache

But it involves updating some file that was never specified. And I'm not sure it is a viable solution in this case anyway.

lee

Upvotes: 1

Views: 1876

Answers (1)

stivlo
stivlo

Reputation: 85476

PHP by default can already access files outside the web root, unless restricted with an open_basedir directive (or safe mode, but hope you're not in that cage).

It's normally a good practice to insert within a VirtualHost configuration an open_basedir restriction. You can specify multiple directories separated by : on Linux and ; on windows.

php_admin_value open_basedir /var/www/s/stage:/usr/share/php:/your/dir

To access those files either use an absolute path or a path relative to the position of the PHP file called. (So you'll have to ../ to reach levels above).

Also be sure that directories in which you want to write to are assigned to the webserver user and have write permission.

Upvotes: 3

Related Questions