How do i find the php code for a website?

Is it possible to view the PHP code of a live website ?

isherwood

54.4k15 gold badges105 silver badges147 bronze badges

asked Aug 23, 2009 at 21:26

2

No, as it is interpreted on the server-side and the results are sent to the user. If you want to view the source code of a site you control in-browser, consider the FirePHP extension for Firebug, or just access your site files with your preferred method.

answered Aug 23, 2009 at 21:28

Jonathan PriorJonathan Prior

5,8947 gold badges28 silver badges26 bronze badges

1

Usually, no, as others have said, unless of course this is something you want to be the case. Then you can set it up so that using .phps [or any other extension really, but this is the norm] will display the source code of the page [with syntax coloring I believe]. Something like:

AddHandler application/x-httpd-php-source .phps

in your apache configuration should do the trick.

Note, you will need to save your .php files with a .phps for their source to be displayed.

answered Aug 23, 2009 at 21:43

1

Everyone is wrong! Yes, it is possible! But if you do see the code in your web browser then this would be a serious security breach or some major trouble in the web server. I've seen it happen once, where some dumb administrator had removed the PHP extension for IIS thus the browser provided all sources as text files instead of executing them.

Then again, there is an alternative method, which is through FTP. Most websites give access to their file system through FTP, so administrators don't need physical access to the system. You will need to know username and password, plus the FTP address to get access, but once you have this information, you have access to the whole site. Useful for administrators, yet also a very good reason to be very careful with passwords.

answered Aug 23, 2009 at 22:30

Wim ten BrinkWim ten Brink

25.4k20 gold badges78 silver badges144 bronze badges

2

Do you have access to the files on the live server? If so yes, otherwise no, it is only possible to see the result of the script execution.

answered Aug 23, 2009 at 21:28

No, unless the server admin screwed up.

answered Aug 23, 2009 at 21:29

Not if PHP is configured properly.

PHP is served already interpreted to the visitor.

Seeing the PHP code on a live website would be considered hacking which is probably outside the ethical scope of stackoverflow.

answered Aug 23, 2009 at 21:30

lpfavreaulpfavreau

12.4k5 gold badges30 silver badges36 bronze badges

3

You can't do that. Because the server side script [here PHP scripts] execute on the web server and its output is embedded inside HTML which is then thrown back to your browser. So all you can view is the HTML. Just imagine, if what you asked was possible, then evryone would have the source code of facebook, flipkart in their hands now.

answered Jun 14, 2016 at 11:50

Vipul JethvaVipul Jethva

6071 gold badge7 silver badges26 bronze badges

answered May 14, 2015 at 2:47

evandrixevandrix

5,9154 gold badges27 silver badges36 bronze badges

0

The only NORMAL way to view PHP source code sitting in some file is to use phps extension, instead of normal php extension. If you make the file extension .phps, decently configured server will output a color-formated source instead of generated html that one would expect. Any other scenario than this one is considered a BIG flaw and the one behind should - panic.

answered Apr 28, 2021 at 1:52

SpookySpooky

1,17014 silver badges17 bronze badges

No, it's not possible as this is considered as security breach

answered Jul 30 at 14:50

How do I get the PHP code from a website?

If you want to view the source code of a site you control in-browser, consider the FirePHP extension for Firebug, or just access your site files with your preferred method. Show activity on this post. in your apache configuration should do the trick. Note, you will need to save your .

How do you find the source code of a website?

To view only the source code, press Ctrl + U on your computer's keyboard. Right-click a blank part of the web page and select View Page Source from the pop-up menu that appears.

How show PHP code in HTML page?

The show_source[] function outputs a file with the PHP syntax highlighted. The syntax is highlighted by using HTML tags. The colors used for highlighting can be set in the php.

Where is PHP code written?

PHP programs can be written on any editor, such as - Notepad, Notepad++, Dreamweaver, etc. These programs save with . php extension, i.e., filename. php inside the htdocs folder.

Chủ Đề