Working with PHP sites
Working with PHP sites

PHP is a server-side scripting language that enables you to build dynamic web pages. PHP pages may contain text, HTML, and script blocks. When a browser requests a PHP page, the PHP script is executed on the web server, and the resulting HTML is displayed in the browser.

A PHP page must have a PHP-supported extension. Typically, a PHP file ends with .php, although other PHP extensions such as .php4 and .phtml also exist. However, .php is the most common extension.

Cc294979.alert_caution(en-us,Expression.30).gifImportant:

For web browsers to correctly display your published PHP pages, PHP must be installed and configured on your web server. For more information, see Installing Expression Development Server and Previewing a PHP page.

To create a new PHP page

Do one of the following:

  • On the File menu, point to New, and then click PHP.

  • On the File menu, click New. In the New dialog box, on the Page tab, click General, then click PHP, and then click OK.

PHP script blocks

A PHP script block can appear anywhere in a .php page, and each page can contain more than one PHP script block. A PHP script block must begin with <?php and end with ?>.

The following is an example of a PHP script block:

<?php
echo "Hello World";
?>
To insert a PHP script block

  • On the Insert menu, click PHP Script.

You can also customize the display of your PHP code in Code view so that you can easily identify your PHP script blocks in the page. For more information, see Change the color of PHP code.

For more information about PHP, see PHP Tutorial on the W3 Schools website.

See also

Tasks

Concepts

© 2010 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View