How do I preview PHP files with external web server?

To be able to preview PHP files, you need to have a web server installed on your computer and it must be configured to support PHP files. Please refer to PHP and web server manuals for more info on installing web server with PHP support.

We recommend using the free Apache web server from apache.org If you are new to this, you may want to go for XAMPP package which will install and configure not only the Apache web server, but also PHP, MySQL and other software needed for web development.

Step 1 - What is your document root?

Identify your local web server document root folder. The document root folder stores web page files available via your web server URL. Please refer to your web server manual for more info.

If you are using Apache or XAMPP package, find the httpd.conf file, open it with a text editor and locate the line beginning with DocumentRoot. There you will find the document root folder.

Step 2 - What is your web server address?

Identify your local web server URL, usually it is http://localhost/

Step 3 - Make sure your web server works

Verify that your web server really works with PHP files. To do this, save a PHP file to your web document root and try to open it via web browser. For example, if your web document root is c:\htdocs, save your file as c:\htdocs\index.php and try to open it via URL http://localhost/index.php

If your web server works, you are now ready to configure internal preview.

Step 4 – Configure internal preview

Now you must tell the editor software how to use your web server to display the PHP file preview.

  1. On the Options menu, click Preferences;
  2. In the Preferences window, click Preview folder;
  3. Click Mappings, then click Add;
  4. Enter your document root folder and the corresponding web address, in the above example you would enter c:\htdocs and http://localhost/