How to View PHP File Types
Files with the .php file extension contain code to display content on web pages. Often, .php files are a mix of HTML and PHP code. PHP is used to perform tasks like storing data from web forms, displaying information from a database or running calculations on dynamic websites. Because PHP code is run server-side, you will not see any PHP code on a website if you view the page source. Instead, you need direct access to the server files before they are sent out to an Internet browser.
Instructions
-
-
1
Open a text editor. Notepad on Windows and Textedit on Mac OS X are capable of reading PHP files. Within the text editor, open the PHP file you want to view like any other file. On Windows, you will need to set the file type to "All files" in the file browser dialog.
-
2
Make the desired changes to the PHP file. If the PHP is accompanied by HTML, you can find the PHP code between specific PHP tags. PHP tags are open with "<?php" and close with "?>." Some servers support a shorter version of the opening tag as "<?."
-
-
3
Upload the changed file to your web server and the changes will take immediate effect. Every time a page containing PHP is loaded the code is executed.
-
1
Tips & Warnings
Text editors like Notepad++ and Text Wrangler offer syntax highlighting to make reading code easier (see Resources).
References
Resources
- Photo Credit computer ed email image by haruspex from Fotolia.com