PhpStorm saving with Linux line ending on Windows

You can safely use the \n line ending for .php and most of other files as well: PHP on Windows will read such files just fine.


To set the default line ending for all new files: go to Settings/Preferences | Editor | Code Style and change Line separator option to the desired style (e.g. Unix and macOS (\n)).

enter image description here


To change line ending for a particular existing file: open the file and either change it via appropriate section in a Status Bar .. or via File | File Properties | Line Separators

enter image description here

enter image description here


P.S.

If you have EditorConfig plugin installed and enabled (it’s a standard plugin now / bundled for quite a few years) then you can also configure this via .editorconfig file: this can be done on per file extension level so it’s even more flexible than PhpStorm’s own settings.

As a bonus: this will also work in another editor/IDE that supports.editorconfig files.

https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#end_of_line

Leave a Comment