Edit excluded remote file (efficient workaround at least)

I know there has been a lot of discussion about that issue but I would like to find an efficient workaround, something different from making an entire empty virtual project just to be able to edit one file once in a blue moon.

Here is a very popular concrete case : WORDPRESS site and wp-config.php file
SO we have this config file wp-config.php excluded from sync because it has not the same params than the local file of course.
AND we need sometimes to be able to make a fast edit to update the password for example.

How can I edit this remote excluded file in a very efficient way ?
Or did I just buy a great IDE that has some very unconvenient little issues?

Thanks for your help.

Comment actions Permalink

Hi there,

You cannot -- PhpStorm (as well all IDEA-based IDEs) does not have such functionality yet (they (devs) always answering "we are working on it" (editing file difectly from remote location) .. but implementing it requires breaking/changing the current "philosophy" of how IDE works with project files -- that is the fact (that's why requirement to have local copy of the project (or project defined at all) makes PhpStorm not really suitable option for people who supports large number of random sites with random edits)).

It may sound a bit of topic to you, but generally speaking  having important the same file to be different on local and remote host (like you are having) is incorrect approach. Instead you should use:

  • 2 config files (one for local and one for remote) and choose the correct one during runtime (don't know how well it plays with the IDE itself -- in terms of duplicate declarations ... but considering it is just config file it should not be an issue).
  • one config file, but apply different config values based on location (local or remote) -- this (detection) can be done dynamically (by IP or host name etc) or statically (by defining some constant in another file -- in local project it will have one value in remote it will have another; this file should be excluded from sync for obvious reasons). I'm using this one all the time and it works perfectly (not with WordPress .. but that should make no difference).

If you want to stick to your current approach, then I may only suggest using any 3rd party tool/editor to do such quick edits (e.g. Notepad++ or whatever). You can make it work with from within PhpStorm as well, but the idea is rather stupid (generally speaking, of course): define another project that will use the same Deployment while it will contain only that single file which you will be able to edit at any time (having separate project just for this labels this idea as "bad").

Comment actions Permalink

I have a similar problem, but even more general. I don't see how to even edit a local file on my system that is not part of the project.

This means that PHPStorm can be used for my PHP projects, but if I just can to edit any old text file or script on my system, better fire up a different editor. But one cannot use PS to just open any old file for editing.

There is a workaround, in going through the Finder and opening a file with PHPStorm. But then you are forced to save the file under a new name, and then go into the file system to replace the file you wanted to just edit with the edited version. This is ugly.

If I like to use the editor, why must it be restricted in this way? What am I missing?

Comment actions Permalink

Hi Jeff,

1. PhpStorm is an IDE, not just advanced text editor. This IDE works with Projects and not individual random files. It needs to index project files to offer code completion, code syntax checks, syntax highlighting etc. That is the architecture behind this product (which is build on what IntelliJ IDEA uses) -- that's why it can offer project-wide code completion and other features that ordinary (or even advanced) text editors do not have. Therefore, If you need to often quickly edit some random file, better stick with your favorite text editor.

2. But nevertheless -- you CAN open ANY text file in PhpStorm, just drag it from file explorer into PhpStorm (at very least it works like that just fine here on Windows).

3. If you need to edit such specific file (that resides outside of project) often, you can open it in PhpStorm and then bookmark it (add to Favorites) -- after that you can quickly re-open it from IDE. Alternatively -- just use symlink (so it will look like it is part of the project) .

Comment actions Permalink


Thanks for you quick response.

I have found out how to open non-project files for editing. As a newbie I only saw on the menu the Save As choice. But Cmd-S saves the file, even though there is no menu choice for it. So Cmd-S at this level of awareness (that is, in looking at the menu for functions) is "undocumented" although I have been using it all along as the expect command sequence.

Just find it a bit odd to take the position that "PS is a great editor, but you need a separate editor for non-PHP project work." Just seems like you should be able to just use it easily. And in fact you can.


Please sign in to leave a comment.