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

I would like to read the contents of PHP file that is on located on some server: How can I do it ?

The only thing I know is the link.

share|improve this question

closed as off topic by EEAA, Bryan, Khaled, Iain Jan 26 '12 at 14:14

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Not possible. This is by design for reasons mentioned in the answers below. Please note that this question is off topic for this site, please see the FAQ for more info. –  Bryan Jan 26 '12 at 14:15

2 Answers 2

up vote 2 down vote accepted

You don't if it's being parsed correctly by PHP (Which it should be), unless the server is your own and you have permissions to browse it locally / with FTP / etc That's the whole point.

But I'll assume that the file isn't yours and you don't have access, so the answer is: You Don't.

share|improve this answer

If you don't own the server and want to be able to view the PHP code using the link only, anyone else can do the same. That would be disaster!! PHP files usually contain sensitive information like DB connection parameters.

You can view the code either by disabling PHP files execution or by accessing the server via SSH and opening the PHP file in a text editor. In both cases, you should have admin access to the server.

share|improve this answer

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