How to handle/use/edit/create PHP files on this site > www.dwyne.net
www.dwyne.net is currently running on the ISP (Internet Hosting/Service Provider) Dreamhost.com. This is the server.
I use an editor/IDE (Integrated Development Environment)
WeBuilder(https://www.blumentals.net/) that provides a local PHP
server/enviroment.
The following refers to PHP contained in a webpage (yours.htm).
- Definitions
- PHP (Hypertext Preprocessor), it is "server side" (remote, what your connected to. google.com).
- PHP is primarily a scripting language, that can interact with a server, databases etc it can also generate HTML code.
- PHP is executed on the server, the resulting(if any) HTML is sent to the client's browser.
- HTML (Hyper Text Markup Language), it is "client side" (this is your system your browser).
- HTML is a text mark up language that determines the structure and layout of web pages.
- HTML is executed on users(your) web browser.
- HTML is static, PHP, Javascript and others interact to provide interactive content if required.
- File Types/Extensions
- .htm or .html files contain html code and may also contain PHP or JS as scripts
- .php files only contain PHP but may output HTM
- The Problem
- Local web browser, WeBuilders provided PHP and the servers (Dreamhost) execute/act differently
- PHP code in file.PHP - online browser OK | in editor(IDE) OK | local file browser NO
- PHP code in file.HTM - online browser NO | in editor(IDE) NO | local file browser NO
- The Solution
- If there is any php always use the extension .php
- Occasionally you may have to rename your source to .htm to use a debugger tools etc.
- Be wary of any reformatting tidy tools, some have a nasty habit of modifing your code.