xdebug mapping setting's in my project php - php

I've been working on setting up correctly my xdebug debugger so I can improve my soft dev process, I manage to get xdebug working with phpstorm for some files that are outside of the project as in the first picture. But when it comes to debug some of the files that are inside of my mvc project (my app folder) I can set my debbuger to work properly and as far as now Im kind of stuck so any help would be welcome.
When I debbug phptest.php it work perfectly because it's an easy mapping
But when I need to debbug something like any php script on my controller folder for example, I can't get to there.
So please any ideas on how to do this.
Regards
Added a new screen shot of my mappings settings as #rafail pointed :)

For further or similar problems, my error was that i added index.php to my excluded paths and because of that I was never be able to debug, I deleted it and now it works fine.
especial thanks to Rafail Akhmetshin for his patience help.
Resume:
Check for exclude paths
Start debugging with phpStorm button
Make sure you are listening on the port
as a note point
make sure to check/uncheck
break at first line on php code
and break on first line when no mapping

Related

Running Wordpress repo locally through MAMP. Assets not being pulled in

Currently I am trying to run a Wordpress repo locally for development. I am not using MAMP pro even though I still have a 9 day trail. I figured since I'm going to be using the free version for now I might as well work with that. I have my Apache & MySQL server running along with the Document Root pointing to my Sites folder where my projectName repo sits. I'm still running off of the default port of Apache 8888.
After I start the servers, I open WebStart and import my DB into phpMyAdmin. Everything works perfectly fine and the copy of my db gets imported. I then make sure that my wp-config.php file has the appropriate settings to access this db. I then click on My Website. This pulls up the content of the website. However, it does not pull in any of the assets(imgs/js/css). I receive the following errors in the console:
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/uploads/2016/09/logo-footer-1.png
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/themes/projectName/images/circle.png
And so the list goes on and on for pretty much every asset the project could possibly have. Now configuration is NOT my strong suit, and at this point I am at a loss of what could possibly be happening. Awhile ago I did follow a tutorial on how to setup my files so that I can access them in the web browser by simply typing the name of the project with the domain .dev, example: projectName.dev. I started having issues with this after upgrading to OS Sierra and it no longer works. Could this possibly be the reason as to why it is looking for these assets in the projectName at the .dev domain?
I apologize if this does not make sense. I am willing to provide anyone with any information on this as I need as much help as possible because I still need to level up my configuration skills. Let me know if you have questions.
The images and other assets are referenced with an absolute filepath (i.e. the URL of the server on which you first set it up). This has to be changed in all database entries. There are tutorials for this on the net, but the most simple version is to open the sql file in an editor and search & replace the general URL part in the complete database.
Be sure to keep a backup of the file - that might not work on the first try...

Why can't I create a new file in my working directory?

I am using PHPStorm 10.0.3 on Windows 7, and I have had no problems working in my project so far. But for some reason, I come into work this morning and suddenly I'm not able to create a new file in any of my directories in my project? This is the error that's occurring:
The error appears 2 more times after I click OK.
I am still able to go into Windows Explorer and create the file manually, so that will tide me over until this problem is resolved.
Thank you all in advance for helping me with such a silly problem.
UPDATE:
It seems PHPStorm thinks the project is "read-only" because when I try and create a new file in the root of the project, I get the error "Cannot modify a read-only directory" followed by the path. I tried using the attrib windows command to remove all read-only attributes but it still hasn't worked.
I'm not sure what fixed the problem, but I tried two things and I thought both of them didn't work. I'll explain exactly what I did for reference to fix this problem.
Firstly, I should announce that I (used to) use Google Drive for all my projects for automated backups. I think that may have messed with the permissions, so I took all my projects out of Google Drive and stopped the process. Didn't fix.
So, I did a combination of the following:
Right-click on the folder, go Properties, and uncheck the Read-only box and make sure it affected subfolders and files too.
Change the permissions on the entire folder so that I was owner, and that "Everyone" had full access to it.
After both didn't seem to work, I tried making a file in the root directory and noticed something about it being read-only. I found out about Windows' "attrib" command, so I performed "attrib -r -s /S /D project-folder-name" whilst in the parent folder of my directory. This also didn't seem to work.
It was at this point I wanted to know if my other projects in the same directory were affected. I closed the problem project, opened another project and tried making a file anywhere. It worked. I tried this for them all. They all worked. So, I went back to the problem directory... and it worked.
I think after making all those changes, I hadn't actually restarted PHPStorm or changed project. I recommend, when trying each of my steps above, restart PHPStorm completely or at least change project to make sure the problem project is closed so you can properly test if the step worked.
I hope this helps someone in the future.
On Windows check if the working directory you are trying to save your code to is added to Ransomware protection. That might be what blocks your IDE from saving files in that specific directory.
You find Ransomware protection by searching for Windows Security. In Windows Security choose Virus & Threat Protection then choose Manage Ransomware Protection and click on Protected folders. If the folder is present try removing it from the list of protected folders.

"Target folder cannot be created" when trying to make Netbeans copy sources folder

I'm trying to test a php app I'm working on in my Netbeans environment, and so I'm setting it up to run on a local Apache server. It seems to work fine when I manually copy my project into the htdocs folder, but when I try to configure Netbeans to automatically copy the sources, It tells me "Target folder cannot be created". I've tried changing the folder from read-only, including everything mentioned here but it doesn't seem to stick (Probably relevant to mention that I'm on Windows 7)
I could just keep manually copying it every time I want to test it, but that would be a major headache. Any ideas?
As I had guessed, it was a Windows permissions issue. After doing pretty much the same thing over and over without the change sticking, it finally stuck, and I was able to get things working the way I wanted. Sigh...

Debugging CakePHP in Netbeans always stops on index.php

I've setup a CakePHP project in Netbeans and use xdebug for debugging. When I start a debugging session, Netbeans stops in the root index.php file on every request. I have to press continue and then my breakpoints are hit.
Is there a way to configure xdebug to avoid this behavior? It's pretty tedious having to hit continue on every request.
Thanks!
Answer in another post: here. Issue was not specific to CakePHP, but rather PHP debugging in general with Netbeans.
Try setting web root folder to APP/webroot. Right click your project and choose properties, then set your source folder to webroot.
Ref: cakePHP debug Netbeans
Hope it helps
Sudhir's answer pointed me into the right direction.
The following worked for me:
Go to project properties.
Click on Run Configuration.
Click browse button next to [Index File] field.
Select app/webroot/index.php.
Breakpoints finally working now!!!
I am sooo happy XD
( PS. I just made the move from Windows to OS X. Whatever installation you are running, make sure you are editing the correct php.ini file. Even PHP veterans like myself sometimes still end up editing the wrong stupid file. )
Paul is correct. This is a netbeans issue, not CakePHP. Uncheck "Stop at First Line".
The larger issue that many people face is getting debugging working in general. If you set the index field as user787301 suggested, then the debugger will launch to webroot/index and throw an error. The solution is to only set Web Root in project properties -> sources as Sudhir suggested.

Breakpoint not firing using PHP/XAMPP/NetBeans/Moodle

Bit of an obscure one this. My setup is all running on my local Windows machine; I've got NetBeans IDE installed, a local XAMPP server with XDebug running, and an installation of Moodle with some custom addons in the mod directory.
I can happily create breakpoints in PHP pages (including the main Moodle ones), but any breakpoints I place on php files in the mod directory never fire (on my mods, or any of the inbuilt ones). I thought Moodle might be doing some "magic" to display files in the mod directory, but my browser shows the url as http://localhost/moodle/mod/view.php - and that's the file I've set my breakpoint in.
Has anyone got any experience with debugging Moodle addins, or could possible point me in the direction of how to troubleshoot the breakpoint not firing? I've tried the Moodle site, but can't find anything relevent.
Actually, I think I've figured it out. If I tell it to debug that particular file it will 404 (it doesn't put the directories in, guess it's a bug), but if I then manually go to http://localhost/moodle/mod/view.php?XDEBUG_SESSION_START=netbeans-xdebug (which errors, no parameters are being passed in), and THEN manually navigate to Moodle then my mod breakpoints fire correctly.
All very bizarre, but it seems to be a usable workaround. I'm guessing the mods are running under some kind of different PHP session.
I'll keep this answer here in case anyone else has this bizarre problem.

Categories