Setting up an external web server to preview PHP and other non-HTML pages [edit]

This topic describes how to set up an external web server, such as XAMPP, for previewing PHP and other non-HTML pages.

Introduction

Currently, to preview PHP pages and have them rendered appropriately, you will need to set up an external web server, such as XAMPP, and use that web server to render your PHP.

You can download XAMPP from the following web site:

http://www.apachefriends.org/en/xampp.html

Instructions

Note: If you are currently running IIS (which runs on Port 80 by default), you'll want to make sure that you do not have a Port conflict when you set up your web server. If your web server uses Port 80, you can stop IIS in order to use this port for your web server.

Note: If you have an existing PHP project, you will create a new project and copy your files into this new project folder to get Preview working for your project.

To set up your web server for previewing PHP (and other non-HTML) files:

  1. Download XAMPP (or the web server of your choice) and install it on your computer according to the installation instructions.
  2. Add your new web server to the Servers View:
    1. Open your Servers View (Window > Show View... > Servers).
    2. Click the Add Server button Image:iconAddServer.png, and select your server type from the drop-down list.

      Aptana Studio opens an Add Server window with the appropriate fields for your server type (shown below).

      Image:addServerWindow.png

    3. On the Add Server window, type a name for your server and add the appropriate path information to specify how to start and stop your server, etc. Some of this information may already be filled in with default values.
    4. Click OK to save your changes.
  3. Select your server in the Servers View, and click the Start Server button Image:iconStartServer.png to start your new web server.
  4. Create a project in the public or htdocs (or equivalent repository) in the directory under where your server is installed:
    1. From the File menu, select New > Project... > Default Web Project in the project wizard.
    2. Type a name for your project.
    3. Uncheck the Use default location box and browse to the htdocs (or equivalent) folder in your server installation directory.
    4. Create a new folder in that directory with the same name as your project and select that new folder for your project location (shown below)

      Image:xamppProject.png

    5. Click the Next button to go to the Import JavaScript Library screen.
    6. Check the boxes next to any libraries that you want to import and click the Next button to go to the Jaxer Support screen.
    7. Select any Jaxer options that you want to include for your project and click Next to go to the HTML Preview Settings screen.
    8. On the HTML Preview Settings screen, check the Define custom settings for this project box, and select your web server from the Choose server list.
    9. Click the Finish button.
  5. If you have files for an existing project, you can copy them into this folder.
  6. Open one of your .php project files in the Aptana editor.
  7. Click the Firefox, Safari, or IE tab at the bottom of the editor to preview your .php page in the Preview pane.

    You can also click the Run button Image:iconRun.png) to view your page in a separate web browser, if you have an existing Run configuration.

Aptana Studio displays a preview of your PHP page.

Note: You may need to make sure that the URL for your preview includes the folder for your project as part of the URL (e.g. "http://127.0.0.1:80/myProject/index.php").

Related Topics