PHPStorm: Open in "Browser" option: how to set the default server to open?
For PHPStorm, I opened the project / site at C: \ site. Then I went ahead and added the PHP built-in web server to localhost port 8081 from the menu bar: Run> Edit Configs.
To view the index.php file when I click View> Open in Browser> Chrome (or any other browser) it takes me to http: // localhost: 63342 / site / index.php
So it looks like he created another server running on port 63342? Also, it has a path like /site/index.php, not just /index.php.
Is there a way to set it up so that when I click view> open in browser> hostname it goes to localhost: 8081 / index.php?
Also, is it possible to shutdown the server running on port 63342?
Version: I am trying to use PHPStorm 8 and 9 and both show the same behavior.
source to share
http://localhost:63342/PROJECT_NAME/
is PhpStorm's own simple built-in web server . It is used if no deployment entries are defined (or not defined but not specified by default for this project).
When you use Open in Browser
, the IDE action checks your deployment options, looking for a base URL that will be used to open such a file in a browser. If it does not find any such entries, then instead of opening this file using the protocol, file://
it uses its own embedded web server.
So, to use your specific webserver / url, you must:
-
Settings (Preferences on Mac) | Build, Execution, Deployment | Deployment
- Create a new record of the appropriate type (or complete the configuration of an existing one if you have already done so)
- Configure it (include url and paths) so that no warnings are shown for the first 2 tabs (Connection and Mappings).
- Mark this entry as Default for this project
The IDE will now use this data when using the action Open in Browser
.
NOTE. , the action Open in Browser
won't start your webserver (the one you created for port 8081) - it just opens the url in the browser. You will need to make sure your server is already running before using this action.
Useful links:
source to share