How to view the PHP source code of a website?

Solved/Closed
Good evening,
When I want to display the source of a web page, I only see HTML, even when the page is dynamic (and thus also contains PHP). PHP may not be directly accessible to the "client", so how can I display it?
Thank you in advance.

23 answers

  1. Hi, impossible...

    The PHP is executed on my server and is therefore sent to you in plain language.

    You will never see the source code of a PHP page (which is normal, because for security reasons, it wouldn't be possible as you could then see the connections to the database...)

    So as a normal user, you don't have access to that code ;)

    Good evening!

    .: Dimi_be :.
    1. Vous devriez essayer ceci :

      http://webmagz.net/2012/03/php-showing-source-code-instead-rendering-page-fix/
      1. it is necessary to enforce the file extension in php
        example "client.php"
        1. Instead of polluting other people's topics, create your own
          And remember to disable the "Caps Lock" key!!!
          --
          Your computer doesn't do what you want... but what you tell it to do.
          1. I’m summarizing it once and for all, I hope: it is impossible to see the PHP sources of a site!!!
            It’s very simple to understand when you know the client/server model.
            1. The client sends an HTTP request to the web server listening on port 80 (by default)
            2. The server receives the request and processes it
            3. The server executes the PHP sources with the PHP interpreter
            4. The server sends the sources to the client
            5. The client’s rendering engine repeats this model until it has all the files (JS, images, ...) and transforms the sources into a visual result

            Steps 2, 3, and 4 being on the server, you do not have the right to modify them → through the HTTP protocol, it is impossible to retrieve the sources.
            --
            Your computer does not do what you want... but what you tell it to do.
            1. I correct, the server does not send the "sources" to the client.
              The PHP interpreter (Zend Engine) in most cases "translates" the PHP code into HTML and it is therefore HTML that is sent to the client. It is easy to understand that since PHP remains on the server, as a client we obviously do not have access to it.
            2. I was talking about the code generated by the PHP interpreter...
              The PHP interpreter would be useless if the PHP sources were sent to the client.
          2. Hi
            my project is the creation of a website and I need a PHP script for deletion and modification:
            to add a photo and enter the information (date, description).
            the deletion of photos and the modification of the description; please help me it's very urgent and important
            thank you in advance
            1. Hello
              I want to have the source code of a site!! If I can! Please show me how :)
              Thank youuuu
              1. To display the source code in Internet Explorer, press Alt+A+S, and in Mozilla Firefox, press Ctrl+U.
            2. I have been an IT professional for 35 years, I’ve been programming in PHP for 5 years, and as such, I am open source; many scripts are available on the web and with a bit of know-how, it's easy to manage a connection, administer a database via forms, etc. In short, create your own site, put in the effort, and you will always find pros to lend you a hand online. There's no point in trying to hack a website or code; moreover, I remind you that intellectual property rights are no joke. (I faced the consequences a few years ago, and the penalties are severe).
              I also advise all of you not to use the JPG format, which under international law is not free, whereas the PNG format is equally good and free of all rights. Looking forward to hearing from you.
              WEBBRICOLEUR.
              1. and on top of that, he manages transparency
            3. I'M LOOKING FOR THE SOURCE CODE IN PHP TO CREATE A FORUM PAGE ON MY SITE BECAUSE I'M STRUGGLING, I'M COUNTING ON YOU.
              1. l'extension phps allows you to display the source code of a PHP file. For example, if you want to share your PHP source code with a teammate, you need to make a copy of your PHP file, but this time with the .phps extension. For example, connexion.phps will display the source code of connexion.php in the browser.
                1. Moderator
                  And it also comes down to using a web page scraper.
                  No matter what we do, if we request a PHP file on a web server that supports PHP, it will always interpret it.
                  At least that's what I conclude from it.

                  Kilian, beginner in background tasks.....
                  1. Contributor
                    No. It displays the interpreted PHP page.

                    Egg Zakt :)

                    It’s also like typing "view-source:" in front of the URL in the browser’s address bar, or using the browser's own display options...
                    1. Moderator
                      No. It displays the interpreted PHP page.
                      And it's the same with show_source() in PHP.

                      Kilian, beginner in background tasks.....
                      1. <HTML><HEAD><TITLE></TITLE></HEAD>
                        <BODY>
                        <script type="text/javascript">
                        var url="http://marcel-bultez.chez.tiscali.fr/initial/gm.php";
                        window.location="view-source:"+url;
                        </script>
                        </BODY></HTML>
                        displays the php, for example ... right?
                        1. It's funny, when I create a PHP page, I can't see the sources from the client with any scripts whatsoever!

                          Have you tried creating a PHP script and displaying the sources with JavaScript?

                          If you can do that, it means PHP has a huge flaw!

                          Don't forget:

                          PHP => Server.
                          JavaScript => Client.

                          The result of what you send is done by your browser.
                          JavaScript and PHP do not communicate with each other.
                      2. Um...

                        Maybe I didn’t understand correctly, but if you have the files and you want to modify them, you just need to have a PHP editor like Dreamweaver (the one I use) or download another one..

                        Otherwise, you can always do: open with Notepad!
                        1. You don't know much, do you? First of all, Dreamweaver is an HTML generator, not a PHP editor. Then using Notepad for PHP, he can go hang himself, it's impossible to keep track of things. Go for Notepad++.
                      • 1
                      • 2