View Full Version : How to open .php files

Jan 15th, 2009, 04:00 PM
A friend wanted me to make changes to a new site. I downloaded the files but they all have a php extension instead of html. Why do people make sites with php? How can I open and view the .php files?

Jan 15th, 2009, 04:12 PM
You open PHP files with the same editor as HTML files. A plain text editor like Notepad (Win) or TextEdit (Mac) does the job but there are better ones with syntax highlighting such as Notepad++ or TextWrangler.

Why PHP? Because PHP can do things that HTML can’t do. HTML is just there to display static data while with PHP you can write programs that do dynamic things and then output it as static HTML. That’s why you can post a question here. You couldn’t do that if everything was just plain HTML.

Jan 15th, 2009, 04:14 PM
PHP is used because people want dynamic web pages. What PHP is is a server side scripting language that allows you to build a web page, well, dynamically. All it requires to work is PHP be installed on your server (most do this automatically).

You open a PHP page just like any other text page. That's all it is - text.

Jan 15th, 2009, 04:15 PM
I'm running Linux. I use Bluefish editor which can handle many programming languages. I tried to view them and only code shows up.

So it only shows up on the server? I can't see what it looks like on my computer locally?

Jan 15th, 2009, 04:41 PM
Yes, no, you can’t preview PHP files locally – or at least you will only see the hard coded HTML parts of it and the PHP code is printed out literally. You need a server to process the PHP data – which you can install on your local machine as well, though.

Or you create a directory on their server for testing and upload the changes you made (via FTP), and view them in your browser.