Questions about deployment and browser mapping
I am new to phpstorm (using v8), using xamp and windows. I have read the deployment and built-in webserver help and they are not helping. I want to be able to do the following:
I want to use xamp as my server so that phpstorm uses xamp's php interpreter. I want F12 to bring up my browser and point to the correct location on my server. C:\xampp\htdocs\idea\my_project\file.php should open up to http://localhost/idea/my_project/file.php when I press F12 to bring up my browser.
Right now, phpstorm is using the built in webserver (localhost:63342) when I press F12. No matter what I do in deployment, I cannot get it to use MY server instead of the built-in one. I have the server set to default in Settings>Deployment, it's on, etc. I can go to http://localhost/idea/my_project/file.php and it WORKS. I don't know what is missing except that the built-in webserver, which I cannot figure out how to turn off, is overriding every attempt to map to my own local server. How can I fix this? I can't even experiment with deployment and mapping options, because the built-in webserver is overriding everything!
Second question: Is there a way to quickly switch my deployment server? Say a button or dropdown on the toolbar, or keyboard shortcut?
Third Question: Is there a way to map a key (like F11) to a secondary browser that opens up/maps to another server? Here is what I would like to do:
I want F12 to open up the file at http://localhost/idea/my_project/file.php.
I want F11 to open up the file at http://2ndlocalhost/idea/my_project/file.php.
I want F10 to open up the file at http://localhost:300/idea/my_project/file.php.
And so on.
Fourth Question: How can I disable the built-in webserver. I can see its usefulness, but it is just getting in the way.
I'm new, so please provide help step by step. This is very frustrating, I am missing something that I thought would be easy enough to do.
请先登录再写评论。
Hi there,
Please ensure that deployment server is marked as Default for this project. If no default assigned then built-in server is used by default.
Default deployment -- no. But you can always use "Upload to..." (you should see a small popup menu asking to choose target server) instead of "Upload to <Default>" -- in this case deployment will happen to manually specified server (as long as it has all path mappings set up).
Don't think it's possible -- unless you create and use separate Run/Debug configurations (needs to be created for every/specific file/target as opposed to "Open in Browser" which automatically uses current file).
It cannot be disabled as it does more than just web server. Plus, once deployment configured, the built-in one should not be appearing unless configured manually (as another deployment entry).
Have you seen this? Have a look if you have not seen it and have time:
I think I have marked my deployment server as default.
I went to Settings > Deployment. I selected my server on the left and click the "Use as default button." On the server's mappings tab, "Use this server as default" is greyed out, indicating it is the default server. I don't know what else I can do beyond that to make it the default - is there any other step? Phpstorm is still using the built in server as the default. Tried restarting and got the same result.
I will read the links you mentioned, but everything I have read so far is that a default server should override the built in server, so I think I am getting stuck on something unexpected to me.
Attachment(s):
deployment cropped.png
I created a new project to test my deployment server and phpstorm it did not use the built-in webserver and instead used my specified server.
This made me think that there might be some caching going on causing phpstorm to not recognize the actual deployment server. I tried restarting and invalidating caches but this did not fix the problem. Maybe it can be fixed manually by editing something in the .idea folder? (I could be completely offbase on this.)
Try unmarking deployment server as Default, Save setting by closing the window, open it again and marking as default again.
You can also try deleting this deployment entry and creating new one instead -- in theory it would be similar to having new project settings in this regard.
Caching -- very unlikely. If it would, then Invalidating Caches with IDE restart should have cured it.
As far as my experience goes it has been always working fine for .php file .. but v8 (till 8.0.2 or maybe 8.0.3 -- not sure) have used built-in server to serve .html file regardless of Default deployment. In current versions it's definitely works as intended .. plus you are not using .html files.
P.S.
You can always backup and delete project setting (.idea subfolder) when project is closed; re-open project (Open Directory) and reconfigure it from scratch (some of the VCS-safe setting files can be restored back from backup files).
I created a new project from scratch, imported my files, added the same deployment configs, and it worked. I am not sure what changed, but something obviously did. Thanks for your help.
By the way, where is mentioned that the built-in server is always used to render .html files? I don't remember seeing that while looking at the help docs, but I could have overlooked it.
Nowhere. It was a bug.