calabiyau Posted May 3, 2007 Share Posted May 3, 2007 Well this is part two to a previous question I guess. I am storing client files above document root for privacy but would like the ability to for each client to view their own files. These files are basically of three types: html docs, php scripts, and items for download. I've managed to get the downloads to work as well as the html pages, but the php scripts do not display the echo commands. Must have something to do with the content type header being text/html but I would've thought that is what the server would output, so it should work, unless i'm really not understanding this. I've tried other content type headers, but all they do is prompt for a download. Anybody able to help with this? if ($_GET['action']=='stream') { ob_get_clean(); $location = "../ext_client_doc/".$_GET['user']."/".$_GET['doc']; $fd = fopen($location, 'rb'); header("Content-Type: text/html"); //These are the other headers I have tried that prompted a download //header("Content-Type: application/x-php"); //header("Content-Type: application/octet-stream"); //header("Content-Type: application/x-httpd-php"); //header("Content-Disposition: inline"); ob_flush(); flush(); while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; Link to comment https://forums.phpfreaks.com/topic/49819-displaying-php-page-above-document-root/ Share on other sites More sharing options...
Nameless12 Posted May 3, 2007 Share Posted May 3, 2007 you can only execute php files with apache inside document_root unless you are including them with include() or require() if you want to execute them outside of root use the cli, if you are using a linux box just add #!/usr/bin/php to the top of the file Link to comment https://forums.phpfreaks.com/topic/49819-displaying-php-page-above-document-root/#findComment-244408 Share on other sites More sharing options...
calabiyau Posted May 3, 2007 Author Share Posted May 3, 2007 never used the cli before. is there something i can add in httpd? Link to comment https://forums.phpfreaks.com/topic/49819-displaying-php-page-above-document-root/#findComment-244423 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.