Page 1 of 1
Dump file contents
Posted: Sun Jul 16, 2006 6:35 pm
by HiddenS3crets
What is the easiest way to display the code inside a file located on a server, such as accessing the file contents of /var/www/html/page.php?
Posted: Sun Jul 16, 2006 6:40 pm
by Burrito
I assume you want to display the php code pre-processed...
if so take a look at
highlight_file()
Posted: Sun Jul 16, 2006 6:42 pm
by HiddenS3crets
No, I don't need to highlight the file, just need to display the contents inside a textarea so they can be edited.
Posted: Sun Jul 16, 2006 6:46 pm
by Burrito
Posted: Sun Jul 16, 2006 6:49 pm
by HiddenS3crets
I've tried that one too, but I cannot access server files directly using that function. Instead I would need to access a file like this:
http://www.domain.com/page.php
This code is all processed by the time file_get_contents() is called so I just have access to the HTML output. I need to access server files directly so I can view the PHP code as well.
Side note regarding highlight_file(): I cannot use it due to safe mode being on. To get around this I tried putting this at the beginning of my script:
I still get the warning that safe mode restrictions are in effect though. Why doesn't ini_set() just turn it off?

Posted: Sun Jul 16, 2006 6:51 pm
by Burrito
fortunately the only way you can do that is to go through the file system. you can not access raw php code through the virtual system (and that's a GOOD thing). If the virtual path is the only method by which you can access the files, then I'm afraid you're not going to be able to make it work.