Question:

Viewing PHP?

by Guest32848  |  earlier

0 LIKES UnLike

Can you view PHP scripts on websites? Is there anyway?

 Tags:

   Report

2 ANSWERS


  1. Unless the server is misconfigured, then no.

    PHP is working on the server then it creates HTML for the browser, sends it back to the web server and the web server sends it back to the client.  You cannot view the PHP code that it took to run the request unless you are on the server itself via FTP/SSH/ect.

    Good question,

    Chad


  2. If you wish to have your php  scripts visible. Create a duplicate copy of the file and add a .txt extension to the file. The web server will see this as a document and display the script instead of sending it to the PHP interpreter for parsing.

    Otherwise, when a properly configured web server encounters a request for a file with a PHP extention it will pass the script to the PHP interpreter for the script to be executed. The interpreter then returns a document striped of its PHP code and populated with the information generated by the code. So anything returned from a HTTP request regarding PHP does not contain any PHP code.

    That is if everything is configured correctly.
You're reading: Viewing PHP?

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.