Preview a PHP page

With Expression Development Server, you can preview both ASP.NET pages and PHP pages locally. In order to preview a PHP page that you created in Microsoft Expression Web, you must also have PHP installed and configured on your computer.

Warning

There are potential security risks when using PHP scripts. For more information, see the section entitled Security on the PHP.NET website.

To install PHP

  1. Download the zipped file that contains the PHP files from PHP.NET, and save the file to your computer.

  2. Open the zipped file by double-clicking it, and then click Extract all files.

  3. In the Extract Compressed (Zipped) Folders dialog box, click Browse.

  4. In the Select a destination dialog box, click Computer, and then click OS (C:). Click Make New Folder, and then name the new folder PHP. Click OK.

  5. In the Extract Compressed (Zipped) Folders dialog box, click Extract.

  6. Open the PHP folder. Locate and then make a copy of the "PHP.INI-recommended" file by right-clicking the file and clicking Copy, and then right-clicking inside the folder and clicking Paste.

  7. Rename the file named "PHP-Copy.INI-recommended" to "PHP.INI".

    For more information on installing PHP, see Installation on Windows systems on PHP.NET.

To install PHP extensions

  • For best results, install only the extensions that you want to use. To install the extensions, remove comment marks from the extensions that you want to use in the PHP.INI file. For more information, see Installation of extensions on Windows on the PHP.NET website.

    Note

    For example, some commonly used extensions are: SMTP, MySQL, Pop3, Zlib, Zip, PDFLib, and Crack.

To use Expression Development Server to preview pages

  1. After you have installed PHP, in Microsoft Expression Web, on the Site menu, click Site Settings.

  2. In the Site Settings dialog box, on the Preview tab, select Use Microsoft Expression Development Server, and then select For only PHP and ASP.NET web pages.

  3. By default, Expression Web locates the php-cgi.exe file installed at C:\PHP or C:\Program Files\PHP. If you installed PHP in a different location, or if the text box under Path to PHP executable for previewing PHP pages in this website is empty, under Path to PHP executable for previewing PHP pages in this website, click Browse, locate and select php-cgi.exe, and then click OK.

    Note

    You can install multiple versions of PHP, and then use the Path to PHP executable for previewing PHP pages in this website to select the version of PHP that you want to use to preview PHP pages. If you want to use this setting for this site only, select Use a PHP executable for this site only.

    To use the current PHP setting as the default setting for all PHP sites other than the sites for which you have defined a custom PHP setting, do one of the following:

    • Select Use the PHP executable set in the Application Options, which will also set your global PHP options in the Application Options dialog box.

    • Click Tools, and then click Applications Options. In the Application Options dialog box, under Path to PHP executable for previewing PHP pages, click Browse, and then locate and select the version of php-cgi.exe that you want to use as the default for your PHP sites.

See also

Concepts

PHP overview

Preview an ASP.NET page

Change the color of PHP code

Create a PHP page

Insert a PHP script

IntelliSense for PHP

Author PHP by using IntelliSense

Set IntelliSense options for PHP

Specify a port number for previewing PHP pages

Preview web pages