Setup advice sought: editing remote php within a CMS package.

Hi all,

I have just installed the PhpStorm trial to see if I can do the following:

I build websites in the Modx cms framework. Some of the php is part of modx and generally not to be touched so as to allow smooth updates. Other custom php files (in the same dir structure) are website-specific and are created and manually updated as part of web development.

I previously edited these custom files via ftp using PSPad, a simple code editor with built-in ftp support. I connected to the ftp account and viewed the file tree as if viewing local files. When I edited and saved a file it automaatically overwrote the file on the server. (individual files are downloaded as they are opened, local copies edited and then uploaded to replace the original. Local copies are discarded on closing the program, so remote files are the master copies).

Now I have moved to a dedicated server supporting only ssh (for security). I want to carry out php file edits as before, but via sftp.

My questions are:

1. Can I set up a project which allows me to manage only the files of my choosing, as opposed to the whole CMS file structure? (So as to avoid down-/up-loading/synchronising files that I don't need/want to).

2. Remote files may occasionally be edited my other means (eg via Plesk or Modx), in which case my PhpStorm local files would effectively be out of date. Can PhpStorm be configured to compare file dates before overwriting the remote only with newer local versions?

I hope I've explained that clearly enough. If not please fire questions at me and I'll try to be clearer.

Thank you!

1 comment
Comment actions Permalink

Hi there,

1) Yes -- during "Create new project" wizard you can choose what folders to skip from downloading.

I personally recommend creating brand new empty local project first and then configure everything else manually. This way you configure your Deployment entry first, then using "Browse Remote Host" you just download only files you want -- more precise control IMO.

Obviously, if you skip CMS files you most likely will not have proper code completion and will see errors/warning about unknown classes/functions. That's why downloading whole (well... majority of) project locally (the important files, like PHP/CSS/JS/Important images -- no need for product/specific post images etc) and then excluding certain paths from deployment is a better choice (IMO, of course). Plus, you can always sync only specific folders/files instead of whole project (you can select few folders at once in Project View and then invoke "Sync with Deployed...")

2) There is "Notify about remote changes" option in Deployment options -- should help.

In any case: if you use "Sync with deployed..." instead of just "Upload to..." you will be able to see the diff before uploading each file. And if such file was modifiedremotely .. you may merge remote into local and then upload final version.

P.S.
In case if you have not seen it yet: https://confluence.jetbrains.com/display/PhpStorm/Deployments+in+PhpStorm


P.P.S.
The most recent v9 EAP build allows you edit files directly over (S)FTP.

AFAIK such files will be temporarily stored outside of the project ... so will show lots of warnings about unknown classes etc and you will have to manually upload such modified files back (NOTE that this is still works in progress: it's a first build with this feature).

More on this: http://blog.jetbrains.com/phpstorm/2015/04/remote-edit-in-phpstorm-9-eap/

0

Please sign in to leave a comment.