Xdebug + XAMPP + Netbeans = fail. Cannot get debugger to work in Netbeans - xampp
I've read other questions regarding this topic. The listed solutions haven't worked.
Installed:
XAMPP 1.7.7
Netbeans 7.1.1
XDebug 2.1.4
phpinfo() shows that Xdebug is installed with all the correct parameters:
zend_extension = C:\xampp\php\ext\php_xdebug-2.1.4-5.3-vc9.dll
xdebug.remote_enable = on
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
However, when I start a Netbeans debug session, it cycles for awhile with no effect. When I stop it, I get the Info box informing me that "No connection from xdebug was detected with in nn seconds. The reasons could be that xdebug is not installed or not properly configured. (their emphasis).
As far as I can tell, I configured everything correctly, restarted the Apache server and it still doesn't work. I'm at a total loss on how to proceed. Any help is appreciated.
Can you believe it!? After spending literally HOURS researching this problem, I finally found the cause which I can only classify as a bug. Now, how do I report a bug? That's the next question.
Here's a summary:
create PHP project and setup NetBeans project site root to subfolder.
(In order to not register for Apache new test site for any new task I
put every new task into subfolder under my local test domain, e.g.
http://test.my/project3/ ). NetBeans will not start debugging session
automatically in this case. You will see a ‘waiting for connection’
message from the image below. Do not worry. Left it as it is. Go to
your browser. I use FireFox 4. And call the script you wish to debug
with additional parameter, e.g.
http://test.my/project3/index.php?XDEBUG_SESSION_START=netbeans-xdebug
When you return to NetBeans you will see that connection with xdebug
is established successfully. To stop XDebug session manually call any
script from the same subdirectory with this parameter
?XDEBUG_SESSION_STOP_NO_EXEC=netbeans-xdebug
The complete solution can be found on my newest hero's blog NetBeans 7.0 for PHP Waiting for Connection to XDebug
Edit: Know what I just discovered? I removed index.php as the index file of my run configuration. Works like a charm without having to manually insert the xdebug section of the url.
I just ran into this with Netbeans 8 and while your answer worked around my problem I think I found the solution that will fix it forever.
Project Properties => Run Configuration => Advanced ...
Ensure that the following entry is selected
Debug URL: 'Default: YOUR URL'
Mine was set to "Do Not Open Web Browser" .....
Now it works as it used to work many months ago :)
I am a .Net programmer and very new to PHP. Recently I was trying to host an open source PHP application on my machine(Windows). After the Struggle for 5-6 days I will list the steps which worked for me.
I uninstalled every previous installations of XAMPP and NetBeans and proceeded with fresh installations.
This might not be the solution for everyone but it worked for me and I hope it helps someone.
install XAMPP
install netbeans for PHP.
Open IIS and stop it. It is running on port 80 by default.(I am running XAMPP on port 80 i.e. default, Running on other port might need additional configuration settings)
Open XAMPP control panel and start Apache. If port 80 is free no problem should arise.
Open localhost in browser in should display XAMPP home page.
open phpinfo() link on the left pane and copy all the contents on page. Go to: http://xdebug.org/wizard.php and paste all the content in TextBox and click Analyze my phpinfo output. It will diplay you the Xdebug file suitable for your configuration.
Download the given Xdebug dll and copy it in C:\xampp\php\ext (Xampp being the default Xampp installation directory)
Goto XAMPP control panel, click on Config button in front of Apache and select php.in,
Find line similar or exacly like,
;zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
(Semicolon means it is commented)
Remove the semicolon and replace the path with the path of dll you just copied like:
zend_extension = "C:\xampp\php\ext\php_xdebug-2.3.2-5.4-vc9.dll"
Similarly find lines
;xdebug.remote_enable = 0 ;xdebug.remote_handler = "dbgp"
remove semicolons in front of both lines and make remote_enable = 1
xdebug.remote_enable = 1 xdebug.remote_handler = "dbgp"
Restart Apache server.
Copy your website code under C:/XAMPP/htdocs/(your_website)/ that means your index.php should be at C:/XAMPP/htdocs/(your_website)/index.php
Open Netbeans select New project -> PHP -> PHP project from existing source and select the folder you just copied in htdocs folder. Set it to run on Local web server.
Set a breakpoint on first line of index.php and debug.
That's it.
Additional settings were suggested on various different posts but above mentioned steps worked perfectly for me.
I think what you might be missing is
xdebug.idekey=netbeans-xdebug
this is the settings I use in my php.ini
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1 # Not safe for production servers
xdebug.remote_port=9000
xdebug.idekey=netbeans-xdebug
xdebug.remote_autostart=false
Read the installation of XAMPP 1.7.7 & Netbeans 7.1 with edditing
the php.ini file as suggested:
http://netbeans.org/kb/docs/php/configure-php-environment-windows.html
Create your PHP project in the local XAMPP directory, c:\xammp\htdocs\*yourproject*
Debug the index.php, you will see that your browser will start with additional parameters:
http://*yourproject*/index.php?XDEBUG_SESSION_START=netbeans-xdebug
Go to your Netbeans, your debugger will be started.
Related
xDebug not working for only one project on PHPStorm
I regularly use xDebug on my projects without any problems although I have one project which I've started developing a Magento Module on and xDebug is not working on it. It does still work on other projects though. I can see xDebug in my phpinfo.php file. xDebug seems to be running on port 9000. $ sudo netstat -tulpn | grep :9000 tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 17261/java I'm using this Chrome extension to start listening to start using xDebug. I don't understand why xDebug will work on other projects but not this one, any advice very much appreciated. UPDATE Interestingly when I added the URL of the project I'm trying debug to the PHPStorm settings of another project which xDebug works fine on, by going File -> Settings -> Languages & Frameworks -> PHP Servers, xDebug kind of works. Both projects are Magento Apps so have same directory/file structure. With this setting Xdebug breaks in that project but with the warning. The script '/var/www/example/index.php' is outside the project. If I try adding this setting to the project I'm trying to debug, nothing happens.
Old xampp folder can't be deleted, xampp no working
I uninstalled xampp and installed a newer version with the latest 5.4 php on Windows. When i tried to install the new version of php, the old folder in C://xampp would delete. I deleted everything from that folder except memcached which I can't delete beacuse someone else is using it. So i installed the new xampp version in xampp54 folder. When i installed the new xampp version, i get this errors for mysql Expected Path: "c:\xampp54\apache\bin\httpd.exe" -k runservice MySQL Service detected with wrong path Change XAMPP MySQL and Control Panel settings or Uninstall/disable the other service manually first Found Path: C:\xampp\mysql\bin\mysqld.exe --defaults-file=c:\xampp\mysql\bin\my.ini mysql Expected Path: c:\xampp54\mysql\bin\mysqld.exe --defaults-file=c:\xampp54\mysql\bin\my.ini mysql When i try starting apache, i doesn't do anything. Anyone knows how to fix this?
Go to Task Manager Processes tab search MySql and click then click End task After that, you can delete Xampp folder.
I found memcached in the services and disabled it and it all works. Lesson of the day: Install xampp in 'xampp' folder, not 'xampp_me' or 'myxampp' beacuse it seems that both apache and mysql rely on them being installed in 'xampp' folder.
Try this: Stop the services: mysql and apache Start > Run > Services.msc Kill the process 'Xampp Controller' from the Task Manager In my case, the services were stopped and removed automatically when I uninstalled the Xampp. So, killing 'Xampp Controller' process worked for me.
To delete the C://xampp old folder we need to stop the mysql service. To stop it, go to start -> run -> type services.msc. Search for mysql & apache and right click & stop. Then you would be able to delete the C://xampp folder.
This is what worked for me: Use the command line (if on Windows) Enter this into the terminal: rmdir /Q /S none-empty-dir (e.g. C:\xampp) See: https://www.windows-commandline.com/delete-directory-from-command-line/
This is worked Go to resource monitor -> associated handle and search the folder you want to delete and end process
I have same issues with you. But this worked perfectly with me. Go to task manager, look for details, and search for the items that denies for deleting the folder. (mine is the php) then end task. You can now delete the xampp folder.
WAMP server 2.4 installation of joomla 2.5.14 stuck on step 4 loading image
I saw similar questions but any of them has not correct answer. The installation of Joomla on localhost does not proceed after step 4. Database Configuration. WAMPSERVER version 2.4 Apache 2.4.4 PHP 5.4.12 MySQL 5.6.12 Joomla_2.5.14-Stable-Full_Package for this i tried left click wampmanager -> PHP -> php.ini This will open notepad on the correct php.ini file, look for this directive max_execution_time = 60 Change it to something larger like max_execution_time = 240 But i did n't get any response still facing installation issue
i had unsuccessfullly tried to intstall joomla 2.5.17 on wamp 2.4. installation would get stuck in the database configuration. i changed the php.ini max execution time to 240 and the installation completed successfully (read about that in the previous answer posted). but be sure to restart wamp server after editing the php.ini file. regards for the help.
Xampp and Mavericks
I recently updated to Mavericks and I am using XAMPP 1.7.3 and I get a child pid 2094 exit signal Bus error (10) in my error_log everytime I try to go to my website. Any idea what would cause this error? Everything was working fine before I upgraded to Mavericks.
backup your httpd-vhosts.conf if needed go to apachefriends.org get the latest osx package ( 1.8.3 with php 5.5) open the dmg and run the install wizard, !! check both core files and developer files !! replace the new httpd-vhosts.conf uncomment vhosts conf in httpd.conf DONE
re - Backing up folders and db - probably not but it never hurts to have a second copy. I always backup php.ini & http.conf as well so I can compare new settings with older ones if I see a performance change BTW - some of your config settings will be different after the install. For example, low level errors (like E_NOTICE) may be reported by default. This may require edits to your php.ini file. For example, the default setting for error_reporting is set to error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT which is fine for development but messy for production (you may see a whole bunch of variable declaration errors) to turn the low-level errors off - set error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT &~E_NOTICE or comment out the error_reporting setting (defaults to reporting everything except for the E_NOTICE errors).
Where does MAMP keep its php.ini?
I have recently got a mac an am not used to developing on a mac at all. I have MAMP Pro 1.9.6.1. I did a locate on php.ini and got this: $ locate php.ini /Applications/MAMP/conf/php5.2/php.ini /Applications/MAMP/conf/php5.3/php.ini /Library/Application Support/appsolute/MAMP PRO/conf/php.ini /private/etc/php.ini.default I changed the name of all of them. Restarted MAMP. It loaded without a hitch (I know odd right?). I am using PHP version 5.2. All of these files are now different names (done one by one for process of elimination). So I figure restart the mac. Same, MAMP loaded no problems, even though all of the php.ini files had been move. On Lamp this that wouldn't even load. But either there is another php.ini file I'm missing (quite possible I don't know how to updatedb), MAMP is really intelligent and just pulls in all of them (less likely) or it doesn't use one.
Note: If this doesn't help, check below for Ricardo Martins' answer. Create a PHP script with <?php phpinfo() ?> in it, run that from your browser, and look for the value Loaded Configuration File. This tells you which php.ini file PHP is using in the context of the web server.
I'm not sure if in MAMP (non-PRO) is the same, but MAMP overrides the modified php.ini everytime it starts. In my case, I needed to use the MAMP menu to change my php.ini file (File -> Edit Template -> PHP -> PHP 5.xx -> php.ini).
To be clearer (as i read this thread but didn't SEE the solution, also if it was here!), I have the same problem and found the cause: I were modifying the wrong php.ini! Yes, there are 2 php.ini files in MAMP: Applications/MAMP/conf/php5.5.10/php.ini Applications/MAMP/bin/php/php5.5.10/conf/php.ini The right php.ini file is the second: Applications/MAMP/bin/php/php5.5.10/conf/php.ini To prove this, create a .php file (call it as you like, for example "info.php") and put into it a simple phpinfo() <?php echo phpinfo(); Open it in your browser and search for "Loaded Configuration File": mine is "/Applications/MAMP/bin/php/php5.5.10/conf/php.ini" The error was here; i edited Applications/MAMP/conf/php5.5.10/php.ini but this is the wrong file to modify! Infact, the right php.ini file is the one in the bin directory. Take care of this so small difference that caused me literally 1 and a half hours of headaches!
The file you have to edit is in MAMP Pro and uses the php.ini file everytime it starts up. Start MAMP PRO Edit File > Edit Templates > PHP 5.3.2 php.ini Restart MAMP Pro Your changes should stick.
I don't know if you ever found an answer to this but I DIDN'T need MAMP PRO to do this. Simply goto the correct path by following what others have said. It's something like... MAMP-> bin-> php-> php(your php version)-> conf-> php.ini The key here is where you're editing the file. I was making the mistake of editing the commented part of the ini file. You actually have to scroll down to LINE #472 where it says "display_errors = Off and change it to On. Hope this helps any
Just run the following command from your terminal, it will show you your Loaded Configuration File easiest way I have ever found. php --ini
Change /Applications/MAMP/conf/php5.2/php.ini if you are using 5.2 version of php. If you are using the 5.3 php version, edit the /Applications/MAMP/conf/php5.3/php.ini. If you are using OSX Lion or OSX Mountain Lion, I recommend you using the default installation of apache and php. Greets!
After running the MAMP server, you have php info link in toolbar Once click, You will get all information about php
Probably the fastest way to access the PHP.ini for the currently loaded version of PHP in MAMP PRO (v.4.2.1): Open MAMP Pro Click on "PHP" under the "Languages" section on the sidebar Tap on the arrow button right next to the drop-down that lets you select the "Default Version" of PHP.
It depends on which version of PHP your MAMP is using. You can find it out on: /Applications/MAMP/conf/apache/httpd.conf looking for the configured php5_module. After that, as someone said before, you have to go to the bin folder. There you'll find a conf folder with a php.ini inside. example: /Applications/MAMP/bin/php/php5.4.10/conf Leo
After going through all the solutions here, the easiest way to find the loaded php.ini file is to go into phpinfo on the loaded MAMP webpage, which will show you the loaded php.ini file. This will also confirm if the parameters you change, like max_file_size, have updated correctly.
On my Mac, running MAMP I have a few locations that would be the likely php.ini, so I edited the memory_limit to different values in the 2 suspected files, to test which one effected the actual MAMP PHP INFO page details. By doing that I was able to determine that this was the correct php.ini: /Applications/MAMP/bin/php/php7.2.10/conf/php.ini
I only have the non-pro version of MAMP but just because it loads it doesn't mean the PHP file is being found/without errors. I renamed my php.ini files and MAMP still started but Apache returned several errors. What are you trying to change in your php.ini file?
I have checked all answers and of course I have used phpinfo() to check the exact location of php.ini. I don't see a File option in the menu bar on my mac. I changed both php.ini and php.ini.temp files in that folder. No vail. Until I realized that I forgot to uncomment the modified always_populate_raw_post_data line.
I was struggling with this too. My changes weren't being reflected in phpInfo. It wasn't until I stopped my servers and then restarted them again that my changes actually took effect.