Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On my current project I have a few private php scripts and I also have phpMyAdmin in a private area of the server.

Is there anyway of opening those files in a browser? I'm currently tunnelling using PuTTy but I don't know how to access the private files.

Thank you :)

EDIT: Basically, we have our web application running in the web_root (httpdocs in this case). We also created a few files that are outside the reach of the server webroot, in a folder on the machine that can only be accessed locally).

What we'd like to do is running those php files as a normal web appication through the browser.

Please let me know if it is still confusing :)

Cheers, Diogo

share|improve this question
    
Its not clear what you are trying to achive here - nor what you are describing. There is no such thing as a 'private area' on Microsoft nor Posix/Unix/Linux systems. What do you mean by 'open'? View the PHP source code? Execute the PHP source code and view the output? Edit the source code? Something else? –  symcbean Aug 25 '10 at 11:19
    
I'm really sorry, let me try to rephrase. (editing main post) –  DiogoNeves Aug 25 '10 at 14:39
    
Still not clear to me. If you want to run those php files as a normal web app through the browser, why don't you just put them into the webroot? –  Jason Tan Aug 25 '10 at 16:56
    
Our problem is that the files we're running need special permissions but we still didn't write the login system. Our idea was to put the files in an area where no one can access (but us) and execute them through SSH. –  DiogoNeves Aug 27 '10 at 10:24
    
Ok, I'm really sorry that I was soooo unclear with this, it's all still a bit new to me and I need to learn the jargon :) Anyway, since the file I need to run shouldn't be accessed by anyone else but machine admins, we've put it in a place out of reach of the public server. Since the file only outputs static html (no input required) we're running it through command line and outputting to a file that we later download and open. This is good for now but if you still have any ideas, please share them :) Thank you all and I'll promise to study the problem a bit better next time. –  DiogoNeves Sep 1 '10 at 13:06

3 Answers 3

up vote 1 down vote accepted

If you have PHP on your server and know a bit of programming, you can use a PHP library called "phplibsec".

This library allows you to connect to a computer via SSH and execute specific shell commands. You can get store command results in PHP variables, so you can develop you own solution.

I'm using it to develop a simple file browser through SSH on my HTPC, to allow me to copy files to pendrives without turning my HTPC's monitor on. You can use it to run "ls" command and parse results via PHP to show files through file browser.

That link explains how to use that library: PHPSECLIB Examples

share|improve this answer

No. SSH and HTTP are separate protocols and use separate servers, so PHP files accessed via SSH are not processed by the PHP engine.

You can use SSH as a proxy to access a HTTP server bound (or restricted) to 127.0.0.1 on the server, but that is a bit trickier.

share|improve this answer

You can do this by creating Symbolic links in the document root. Suppose you have files in some-php-files-directory and you want to access them via browser.

  1. Create Symbolic link to that directory

    ln -s /path/to/some-php-files-directory /document/root/link-name

This creates the symbolic link named link-name in the document root that refers to some-php-files-directory

When you type http://domain.com/lik-name/ it points to files in the some-php-files-directory

Hope it's clear.

share|improve this answer
    
Thanks. That helps for some of it :) –  DiogoNeves Aug 27 '10 at 10:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.