PhpStorm 2016.3 Help

Create and Run Your First PHP Project

To get familiar with PhpStorm it is recommended that you create your first project from scratch and implement the very basic functionality in it.

Creating a living PHP application that enables you to view results in a browser of your choice requires the following preconditions to be fulfilled:

  • A local Web server is installed, configured, and running on your computer or access to a remote server is configured.

    This topic supposes that the local Apache HTTP server is used and its root directory is .\htdocs.

  • The PHP engine is installed and configured.

You can install each component separately and then configure the environment. Alternatively, install an AMP package compatible with the operating system you use to have the components and the entire environment configured without any steps from your side.

Creating and Run Your First PHP Project

  1. Create a project. For that, choose File | New | Project on the main menu.
  2. In the Create New Project dialog box that opens specify the name of the project in the Name text box, for example, type MyFirstPhpProject.
  3. Click the Browse button browseButton.png next to the Location text box.
  4. In the dialog that opens select the path to the .\htdocs folder and click OK. PhpStorm composes the path to the project folder as follows:
    webphpcreateNewProject.png
  5. Create a PHP file. To do that, right-click the project directory in the Project tool window, point to New on the context menu, and choose PHP File.
    webphpcreatePhpFile.png
  6. In the New PHP File dialog box that opens type MyFile and click OK. PhpStorm will create the stub file for you and open it in the dedicated editor tab.
  7. Type this sample code:

    echo phpinfo();

  8. To save the file, choose File | Save All or press Ctrl+S.
  9. Open a Web browser and type the following URL address:

    http://localhost:<port>/MyFirstPhpProject/MyFile.php

    The PHP Information page opens displaying the PHP engine configuration settings on your computer.

    php_storm_first_project_output.png

See Also

Last modified: 23 March 2017