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.

Important

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 Cc294979.xtlink_newWindow(en-us,Expression.40).png on the W3 Schools website.

See also

Tasks

Author PHP by using IntelliSense
Set IntelliSense options for PHP
Change the color of PHP code
Create a PHP page
Insert a PHP script
Previewing a PHP page
Show or hide PHP formatting marks in Design view

Concepts

Using IntelliSense with PHP

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.