PhpStorm - Wrong icon for language - php

I just updated my PhpStorm to the latest version (2017.1.2) but when I open my current project (Laravel) I saw wrong icon in each file for PHP, the icon is C like in this picture:
But when I see for another directory, the icon is correct:
How to change the Icon to correct icon? Is it just an icon or also change the programming language to C?

The C is just indicating the file is entirely made up of a class matching the name of the file.
This is a recent addition to PhpStorm.
This icon has no effect on the type of file, it is still a PHP file.

Related

How to recover non-project file protection in PhpStorm?

This dialog appears when I try to edit non-project files.
I chose the 1st option, but I want to recover this protection. Restart didn't help.
Starting at some version, the IDE will no longer show this dialog for the recently edited files. You need to remove such a file from the recently edited files list to get back this popup for that file.
Sadly you cannot do this from the UI so you will have to edit the config files directly. This will be a bit tricky as it involves looking in 2 different places (config files) and editing one of them.
NOTE: this applies to the 1st option ("I want to edit this file anyway"). It may work completely differently for the 2nd option (directory exclusion most likely will be stored in a different place).
Do this while the project is CLOSED in the IDE (or even better, the whole IDE is closed).
Open this project settings folder, locate workspace.xml file and open it in your plain text editor, i.e. PROJECT_ROOT/.idea/workspace.xml.
Locate the component node with ProjectId name. You need the value of the id attribute.
<component name="ProjectId" id="1OVsD6SX2AzSazagHBXOTEBLIaW" />
We are now done with this file.
Go to your IDE-wide config folder. On Linux that would normally be ~/.config/JetBrains/PhpStorm2022.1 for the current PhpStorm 2022.1 version. For other OS: https://www.jetbrains.com/help/phpstorm/directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#config-directory
NOTE: if you have installed your IDE using JetBrains Toolbox App, the path might be different. You need to see idea.log file (Help | Show Log in XXX) for the used paths (they are printed at the start of each IDE launch session), although it should be possible to open such a folder right from the Toolbox App interface.
Locate the file named with the id value from step 2 in the workspace folder there. E.g. in my example that would be IDE_CONFIG/workspace/1OVsD6SX2AzSazagHBXOTEBLIaW.xml
This is the file with your local IDE workspace for this project that is not meant to be shared/synced (as it contains user/machine specific paths etc.)
Open that file in your plain text editor and locate the <component name="IdeDocumentHistory"> node.
You need to remove unwanted entries from the <changedPaths> sub-node. E.g.
<option value="$PROJECT_DIR$/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManagerInterface" />
Save and exit. Launch the IDE and do your test.

How to use VSCode to remotely edit website files?

I need to be able to remotely log into web servers for my clients and edit code remotely. I mostly use this for CSS changes, but also am starting to play with PHP as well.
I have tried to get Remote-Editor to work but it won't pick up the .remote file that I placed in the /home folder. The instructions don't really give great details on setting this up.
What do I do?
Use FileZilla, then set VScode as default editor (edit->settings->file editing->filetype associations and insert "php /usr/bin/code"). okey, now u need select your file on FTP and press "View/Edit", then ur file open in VScode editor. Done:)
Use an FTP client (like FileZilla), then set VSCode as the default editor. Anytime you open a file, it will open it in VSCode. I highly recommend that you download all of the code to your own computer and use it as a dev environment, and then, when you're finished with your changes, backup your site, then upload the modified files together. It's not required to edit files on your own machine, but it is recommended if you ever need to revert to an old version for whatever reason (like you made a mistake in the code, and now nothing works right).
Alternatively, you can use an extension like FTP Sync to code locally, and have the files be automatically synced for you.
Open Filezilla -> Edit -> Settings -> File Editing -> Filetype associations
Now you will have "Custom filetype associations:" situated on the right pane of the window.
Over there you have to write the command for opening VSCode for PHP files.
Step 1: Search and locate the VSCode Exe file setup install directory on your computer. In my case it was (C:\Users\Shubham\AppData\Local\Programs\Microsoft VS Code/Code.exe)
Step 2: Copy the directory path link of the ".exe" file and come back to the "Custom filetype associations:" inside Filezilla.
Step 3: Now type "php" then give space & paste the directory path that you have copied inside double quotes and then again give space and write "-open". The final code should look something like this
php "C:\Users\Shubham\AppData\Local\Programs\Microsoft VS Code/Code.exe" -open
Step 4: Click the Okay Button and have a coffee.
There are several approaches to this that are all editor-agnostic.
First, there is sshfs, which is cross-platform and you can install via your OS package manager. A simple approach would be as following:
mkdir -p ~/mnt/server
sshfs user#server.example.com:/path/on/server ~/mnt/server
Afterwards, you have the complete folder structure from server.example.com locally available at ~/mnt/server. Make sure you set up SSH keys to avoid entering the user password every time. You can find tutorials on that everywhere on the net.
For servers that only offer FTP access (shared hosting and the like), you can use curlftpfs in the same fashion.
To close the connection, simply unmount:
umount ~/mnt
For a GUI-based approach, you have several options. There is Transmit (macOS), which features mounting connections as volumes, Forklift (macOS) which is a Finder replacement that can do the same, ExpanDrive (macOS/Windows) and my favorite Mountain Duck (macOS/Windows).
If you plan to move lots of data, especially a lot of small files, Mountain Duck performs the best in my experience.
Just type this is Filezilla Settings->File Editing-> File Association
php /snap/bin/code
Open Filezilla and go to Edit >> Settings
Click on File Editing, and set the radio button to use Custom Editor
In the text field below you need to enter the full path to Visual Studio Code, this is usually found in the /usr/bin/ directory, so you need to enter the following /usr/bin/code
Next select the radio button Always use default editor and click OK to finalise the settings.
Most of the answers I see are for Windows. If anyone wants to associate File Types using Linux in Filezilla, the path is a bit different.
htm /snap/bin/code --force-user-env --no-sandbox --unity-launch
html /snap/bin/code --force-user-env --no-sandbox --unity-launch
js /snap/bin/code --force-user-env --no-sandbox --unity-launch
php /snap/bin/code --force-user-env --no-sandbox --unity-launch
You do not need to use the extra flags, but they are being used in the Menu Shortcut, so I included them.
To set VS Code as default editor for all type of files in mac use below steps:-
Click on Edit menu
Then click on setting option
Then find out File Editing and click on it (Not on submenu(Filetype associations))
Click on custom editor and then browse in application or download and select VS Code. And also click on checkbox "Always use default editor" and then click ok.
open filezilla->edit->file editing->use custom editor->browse(find the visual code path)
for find visual code path->right click on the visual code and open location and paste that location to the browse menu and find the visual code short cut
after that press ok on filzilla it will work fine
It's important that you start Filezilla as an administrator. That was the reason why it wasn't working for me.
Open Filezilla -> Edit -> Settings -> File Editing -> Filetype associations then type:
php "C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\Code.exe" %f
Note: substitute <username> with your windows username
Bonus: php can be replace with any kind of file format. Just write file extension name on lowercase.
I used this registry update to set vscode as my default text file editor (copy & paste into update.reg, open regedit and import the file):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SystemFileAssociations\text\shell\edit\command]
#=hex(2):22,00,25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,4c,\
00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,00,4c,00,\
6f,00,63,00,61,00,6c,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,73,\
00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,\
53,00,20,00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,00,65,\
00,78,00,65,00,22,00,20,00,25,00,31,00,00,00
After that the registry is updated as follows:
Of course you should not trust hex encoded registry updates you found in the internet. So copy 22,00 ... 00,00, remove all backslashes, linebreaks and whitespaces and convert through one of many hex to ascii online converters to verify the import:
After you made this change you can even edit text files with vscode through the "edit" context menu entry:

PHP desktop how to change the main window icon

I am starting to use PHP desktop to create a desktop application and it works great, just want to know if there's any settings to change the main windows icon, i know to change the pop-up windows icon can be change on settings.json, but i cannot find any settings to change the main windows.
Note: im using Inno Compiler to distribute my application, but the compiler only change the set-up icon not the main application.
I had the same problem, the solution is provided by the creator -
If you would like to change the icon that is embedded in the executable file then do the following steps:
Download Resource Hacker and run it.
From the "File" menu select open, navigate and choose "phpdesktop-msie.exe" (or "phpdesktop-chrome.exe").
On the left side there should be a tree control, expand "/Icon Group/128/1033", right click on the "1033", select "Replace Resource..." and replace that resource with your icon.
That's it, save it and see the changes by running the executable file.
When you change icon embedded in the executable file you do not need to set it anymore in the settings file.
Put .ico image inside your folder and edit setting.json file like below
"main_window": {
"title": "----",
"icon": "ico.ico",
----},

PhpStorm debug showing same file twice

I have a simple index.php file set up for debug testing. When I select Run->Debug in the PhpStorm IDE, I see a popup menu that shows the index.php file twice. Debug only works if I select one of them. Does anyone know
Why is it showing twice?
Is there something I can do to make it only show once?
I see there are different icons in the menu, but can't tell what they are or mean...
Right after posting this, I figured it out.
Select the first option in that little menu, Edit Configurations...
Check the box marked Single instance only
Not sure why this works, so if anyone knows, please feel free to comment.
Those are two different debug configs:
First one is JavaScript debug in Google Chrome browser
Second one is "PHP Script" type of config -- to run/debug your php file in CLI environment.
You can check and edit your Run/Debug Configurations via drop down box on main toolbar (next to Run/Debug buttons) or via Run | Edit Configurations....
You will notice there that both of these entries are:
Located under different roots ("JavaScript Debug" and "PHP Script" accordingly)
They are not "permanent" but temporary (icon is faded) which means that they were created automatically by IDE when you choose them for first time (either via context menu or by invoking hot key).

How to run php extencioned files in CMD (DOS)?

Is there a possibility to run a php file by using the cmd? So it will become much easier to see things without using any html codes in it.
Show Desktop.
Right Click My Computer shortcut in the desktop.
Click Properties.
You should see a section of control Panel - Control Panel\System and Security\System.
Click Advanced System Settings on the Left menu.
Click Enviornment Variables towards the bottom of the window.
Select PATH in the user variables list.
Append your PHP Path (C:\myfolder\php) to your PATH variable, separated from the already existing string by a semi colon.
Click OK
Open your "cmd"
Type PATH, press enter
Make sure that you see your PHP folder among the list.
That should work.
Note: Make sure that your PHP folder has the php.exe. It should have the file type CLI. If you do not have the php.exe, go ahead and check the installation guidelines at - http://www.php.net/manual/en/install.windows.manual.php - and download the installation file from there.

Categories