PhpStorm debug showing same file twice - php

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).

Related

Unable to load the PHP files other then index.php file from NetBeans

I am trying to run the other PHP files from my project folder that I am currently working on, I get this error while running it straight from NetBeans.
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
Otherwise, when I run the project from localhost it opens up the main page index.php perfectly.
Please advise on what I am missing.
The address that I am trying is:
http://localhost/evs/php342/project/process/process_signup.php
I hope your project structure looks like this
If you want to run process_signup.php as your default page while running the project from Netbeans you should configure the project.
In order to do that Right Click on your project and select Properties
Now select Run Configuration
In Index File text field select the process_signup.php file by using the Browse button right to the text field.
Now you're good to go. Right Click on your project and select Run. After that Netbeans will launch your default page.

How to properly setup debug configurations in PhpStorm

I have a project in PhpStorm and I would like to be able debug any php file in any folder. The only way I managed to debug a php page was to set it explicitly in the debug configuration:
Note that I'm typing the full path to a php file in a specific folder. Now if I want to debug another file, I have to create another configuration for that new file. What if I want to debug more 2, 3 files? Do I have to create a new configuration to every single file?
I can also right click a file and then select Debug. It launches in the browser but this way it doesn't stop on the breakpoint (the same breakpoint that it stops in the above example, so both xdebug and chrome extension are working correctly).
It seems that if I right click the file and then select Debug it's creating a temporary configuration but of type 'JavaScript Debug' as can be seen in the following picture:
Then it makes sense it's not stopping in the breakpoint, since it's expecting Java code. Is there any way to change this? Am I missing something?
This is what I do:
Start the debugger and switch to the browser tab that opened. Note that in the browser a query parameter is added to the URL; something like XDEBUG_SESSION_START=15412. From then on, the debugger will be activated by any http request that has this parameter set to this value in $_GET, in $_POST or $_COOKIE. You can also see the right value within the IDE. The debugger tab will have the message Waiting for incoming connection with ide key 15412
Here is the key: after I set my breakpoint in the file I want to debug, I just navigate to it in the browser, but I first add the same query parameter to the url. Easy!

app_dev.php not always refreshing . How to contrain Netbeans/Browser to display freshest version of code?

it's so annoying.
I'm working with Netbeans and Chrome (but other browers are not better) and i never know whether an error comes from last edited code or previosly edited.
app_dev.php suppose to take care of that, but its not.
I do not know whose cache is responsible for this: Netbeans, Symfony, Browsers.
How to contrain displaying latest version of my code?
edit
if do following steps its not work well:
physically delete cache (even command cache:clear --env=dev)
change code
refresh site
if do following steps its work well:
change code
physically delete cache (dev)
refresh site
Netbeans is an IDE. It will not cache any files I think. Try following this steps:
Use Ctrl+F5 in Chrome to refresh the page with discarding the browser cache
Execute php app/console cache:clear --env=dev after each source code modification
Check your URL in browser address. It should be something like http://localhost/web/app_dev.php
#Olim pretty much covered it all. Only thing I would add is to try physically removing cache directory and running cache:clear again...
EDIT:
I had numerous problems with access rights of my IDE (phpStorm in my case) which could not alter files stored in Apache's default location (C:\Program Files\Apache...). The main cause was the dreaded Windows's UAC which prevented any program to write in some more sensitive locations.
To solve this you can either disable UAC or you could set the proper ownership:
Right click on you project's directory
Click Properties
Click the Security tab, then Advanced button
Switch to Owner tab and then Edit button
Click Other users and groups and enter your username. Click OK
Make sure you check the Replace owner on ....
Restart all related software (Netbeans, Chrome, Apache service...)
Does it work now?

How to display "git blame" in PhpStorm after opening file by default

How to display "git blame" after opening a file by default in PhpStorm.
Without "right-click the left gutter, and select the Annotate option",
I want to display "git blame" by default after just opening files.
'git blame' is supported - the command is called annotate in PhpStorm.
Right-click the file
Choose Git > Annotate
You can set a hotkey for almost anything in PHPStorm.
Click Preferences > Keymap. Search for Annotate. You can then set a hotkey to toggle Annotations in PHPStorm.
This doesn't exactly solve the problem of showing annotations when a file is opened but does eliminate the need for lots of fiddly clicking.
It is possible with the GitToolbox plugin. These settings are enabled by default i think and it also displays the blame in the status bar.
If you want to edit the settings, you go to File-> Settings-> Version Control -> GitToolbox and you can see the checkbox 'Show editor inline 'Blame''.
It's not exactly an solution, but can help if you're tired of creating new shortcuts for every little functionality that you need.
You right click the file, press G, release, and press N
it's the same as pointing to the GIT, waiting for the window to popup and selecting the annotate function, only faster.
That's the way I do.
Hope it helps somebody

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