Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you mean to read the <code>php</code> source, then the answer is no - you cannot read <code>php</code> source in a typical webserver configuration. In most cases it would be very insecure to allow it - passwords and other constants are often stored in <code>php</code> source code.</p> <p>If however, you are just meaning to read out the result of executing the <code>php</code> document, as a browser would do, you can use something like;</p> <pre><code>URL u = new URL("http://www.example.com/my/php/doc.php"); URLConnection c = u.openConnection(); InputStream r = c.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(r)); for(String line; (line = reader.readLine()) != null;) System.out.println(line); </code></pre> <hr> <p>To read the source of a remote <code>php</code> document via http, the webserver needs to be configured to <em>not</em> parse &amp; execute the file, rather just serve it blindly as a plain text file.</p> <p>This can be achieved in a few ways;</p> <ol> <li>Uninstall <code>php</code> - no php engine, no code execution.</li> <li>Change the file extension - apache actually just identifies files by their file extension, so changing it to <code>.phpsource</code> would do the trick in many instances.</li> <li>Alter the apache configuration - either globally, or via <code>.htaccess</code> you can alter webserver configurations for a single directory. You would want to do something like <code>php_flag engine off</code> or <code>RemoveHandler .php</code></li> </ol> <p>Note that only the first, and <em>maybe</em> the second, method above <strong>does not</strong> open up potential security holes in your server. So use with caution.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload