Creating a Project from Existing Local Sources
When the files to work with are already on your machine, you can set up your development environment in three main ways:
You do not have a Web server on your machine or you are not going to use it right now. The sources are on your machine, you just do your development, possibly using the console to view the output. In this case, you can just open the folder under which the sources are stored without configuring access to a server. However, you can also use the New Project wizard.
You have a Web server on your machine, the sources are under the server document root (for example, /htdocs), and you do your development right on the server. In this case, you need to use the New Project wizard to arrange the sources in a project, appoint the project root folder, and configure access to the server through a server access configuration of the type in-place.
The Web server is installed on your computer but the sources are stored in another folder or on a mounted drive. You do your development, then synchronize with the server. Use the New Project wizard to arrange the sources in a project, appoint the project root folder, configure access to the server through a server access configuration of the type local, and map the folders under the project root folder with folders on the server.
Creating a Project by Opening the Folder where the Sources Are Stored
If you are not going to use a Web server right now, you can just open the folder with the files to be arranged in a PhpStorm project.
Click Open on the Welcome screen or select from the main menu.
In the dialog that opens, select the directory that contains the desired source code. Note that applications created externally are marked with the regular directory icon .
Click OK and specify whether you want the new project to be opened in a separate window or close the current project and reuse the existing one. See Opening Multiple Projects for details.
Creating a Project Around Existing Sources Without a Server Using the New Project Wizard
Another way to arrange the source in a PhpStorm project is use the New Project wizard.
To start the New Project wizard, choose on the main menu.
On the Choose Your Scenario page, choose Source files are in a local directory, no Web server is yet configured and click Next.
On the Choose Project Directory page, select the folder where your sources are stored and click the icon on the toolbar or choose Project Root from the context menu of the selection to appoint the folder project root. PhpStorm marks the selected folder with the icon.
Configure the folders under the project root. Alternatively, you can do it later on the Directories page of the Settings dialog.
Click Finish and specify whether you want the new project to be opened in a separate window or close the current project and reuse the existing one. Refer to the section Opening Multiple Projects for details.
Creating a Project from Existing Sources Under the Server Document Root
In this case, you need to use the New Project wizard to arrange the sources in a project, appoint the project root folder, and configure access to the server through a server access configuration of the type in-place. In this case, you need to use the New Project wizard to arrange the sources in a project, appoint the project root folder, and configure access to the server.
To start the New Project wizard, choose on the main menu.
On the Choose Your Scenario page, choose Web server is installed locally, source files are located under its document root and click Next.
On the Choose Project Directory page, select the folder where your sources are stored and click the icon on the toolbar or choose Project Root from the context menu of the selection to appoint the folder project root. PhpStorm marks the selected folder with the icon.
Configure the folders under the project root. Alternatively, you can do it later on the Directories page of the Settings dialog. Click Next.
On the Specify Local Server page, appoint the server access configuration to use. For more details, see Configure synchronization with a Web server.
Do one of the following:
Choose Use existing server and select the relevant server configurations from the list. The list contains only configurations of the type In-place marked with , because your files are already under the server document root.
Choose Add new local server, click Next, and define a new server access configuration on the Add Local Server page that opens:
Specify the server configuration name in the Name text box. PhpStorm itself sets the configuration type to In-place.
In the Web server URL field, type the URL address associated with the document root of your Web server as defined in the Web server configuration file. This URL address will be the starting point for building the URL address of your application.
Both the HTTP and the HTTPS protocols are supported.
For example, the default document root is set to the htdocs folder, and the default URL address to access the data in it is http://localhost. If you have changed the default port 80, you have to specify the port explicitly: http://localhost:<port>.
Click Next when ready.
On the Specify Web Path page, specify the URL address to access your project root folder. In the Web path for project root text box, type the path to the project root folder relative to the server document root specified in the server configuration file. As you type, PhpStorm dynamically builds the URL address and shows as a link in the Project URL read-only field. To check that the URL address is constructed correctly and ensures access to the project root, click the link.
For more details, see Create an in-place server configuration.
Click Finish and specify whether you want the new project to be opened in a separate window or close the current project and reuse the existing one. Refer to the section Opening Multiple Projects for details.
Creating a Project from Sources Outside the Server Document Root
The Web server is installed on your computer but the sources are stored in another folder or on a mounted drive. You do your development, then synchronize with the server. In this case, you need to use the New Project wizard to arrange the sources in a project, appoint the project root folder, and configure access to the server.
To start the New Project wizard, choose on the main menu.
On the Choose Your Scenario page, choose Web server is installed locally, source files are located elsewhere locally and click Next.
On the Specify Local Path page, appoint the project root. Specify the folder where the sources are stored and where the project will be created.
On the Specify Server page, appoint the server access configuration to enable interaction with the server. For more details, see Configure synchronization with a Web server.
Do one of the following:
Choose Use existing server and select the relevant server configurations from the list. The list contains only configurations of the type Local marked the , because your files are stored locally on your machine but under the server document root, so a configuration of the In-place type would not fit.
Choose Add new local server, click Next, and define a new server access configuration on the Add Server page, that opens:
Specify the server configuration name in the Name text box. PhpStorm itself sets the configuration type to Local.
In the Folder text box of the Upload/download project files area, specify the server configuration root.
The server configuration root is the highest folder in the file tree on the server that can be accessed through the server configuration. The easiest way is to use the document root of your Web server as defined in the Web server configuration file. However you can appoint any other existing folder under the document root.
In the Web server URL text box of the Browse files on server area, specify the URL address of the server configuration root. This URL address will be the starting point for building the URL address of your application. Depending on your choice of the server configuration root, do one of the following:
Type the URL address associated with the document root of your Web server as defined in the Web server configuration file.
Type the URL address in the following format:
<Server document root URL>/<path to the folder relative to the server document root>
Click Next.
For more details and examples, see Create a local server configuration.
On the Choose Remote Path page, create a folder on the server where PhpStorm will upload the project files. This folder is called project root on the server and it will be automatically mapped to your project root.
The page shows a tree of the folders under the appointed server configuration root. Select the relevant parent folder and choose Create Folder on the context menu. When the new folder appears in the tree, select it and click the icon on the toolbar or choose Project Root on the context menu of the selection. PhpStorm marks the selected folder with the icon.
Configure the folders under the project root. Alternatively, you can do it later on the Directories page of the Settings dialog. Click Next.
On the Specify Web Path page, specify the URL address to access your project root folder on the server which you appointed in the previous step. In the Web path for project root text box, type the path to the folder relative to the server configuration root. Actually, type the relative path to the project root on the server text box. As you type, PhpStorm dynamically builds the URL address and shows it as a link in the Project URL read-only field.
Configuring folders under the project root
PhpStorm can distinguish between Source folders, Resource Root folders, and Excluded folders. By default, any folder is treated as Source folder unless it is associated with another type.
You may also need to suppress upload/download of files and folders. Suppressing uploading, downloading, and synchronization for files or folders with sources ensures that the sources are protected against accidental update. When applied to non-sources, it can save system resources because media, caches, or temporary files are no longer copied unnecessarily.
Select the directory you want to mark and do one of the following:
To have PhpStorm ignore the selected directory during indexing, parsing, code completion, etc., click the Excluded from Indexing toolbar button or choose Excluded on the context menu of the selection.
To enable PhpStorm to complete relative paths to resources under the selected folder, click the Resource Root toolbar button or choose Resource Root on the context menu of the selection.
To suppress uploading, downloading, and synchronization for the selected folder, click the Excluded from Download icon or choose Exclude Path on the context menu of the selection.
For details, see Configuring folders under content roots and Exclude files and folders from uploading and downloading.