Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seeking virtual machine with Xdebug working for PHP in Netbeans

I have followed many user guides, spent many a long hour, read these questions on S.O

How to debug PHP with netbeans and Xdebug
How to debug PHP with netbeans and Xdebug in Windows?
How do you debug a PHP test file in Netbeans?
Debug php with Netbeans - Newbie source request
Debug next PHP page in Netbeans from Firefox
How to debug a PHP application?
how to run php file in netbeans

and am currently waiting for my hair to grow back in order to tear it out again.

Anyhoo, it seems that someone else must have solved this already, so … can anyone point me at a download URL for a free virtual machine with Netbans configured for Xdebug with PHP?

Obviously it will be Linux; I would prefer Ubuntu, but will accept anything. I have a slight preference for Virtual Box, but VMware is just fine.

I am sure that this will help many people, so thanks on behalf of us all.


Alternatively, you may wish to post a (link to a) known to be working PHP.INI (although I appreciate that that will requier a little edtting)

like image 585
Mawg says reinstate Monica Avatar asked Dec 28 '25 21:12

Mawg says reinstate Monica


2 Answers

I can't offer you a VHD download but this is how I've done mine using VirtualBox

Networking Setup

This is probably the most important bit. Add two network adapters to your VM. The first can be a standard NAT connection so your VM can connect to the Internet. Make the second a "Host-only Adapter".

Install Ubuntu Server onto your VM.

Open /etc/network/interfaces and add the second adapter with a static IP in the 192.168.56.1/24 range (this is the VirtualBox host-only network subnet), eg

# The primary network interface
auto eth0
iface eth0 inet dhcp

# Static VBox IP
auto eth1
iface eth1 inet static
address 192.168.56.10
netmask 255.255.255.0

After restarting your VM, you should be able to connect to it on that static IP.

I ♥ LAMP

  1. Install Zend Server CE via the manual DEB method listed here - http://files-source.zend.com/help/Zend-Server-Community-Edition/zend-server-community-edition.htm#deb_installation.htm
  2. Install XDebug via PECL, eg sudo /usr/local/zend/bin/pecl install xdebug. You may need to install some dependencies like gcc and make before this works.
  3. Remove the Zend Debugger config symlink, eg sudo rm /usr/local/zend/etc/conf.d/debugger.ini

Configure XDebug with the following. Add this above the [Zend] section in /usr/local/zend/etc/php.ini

zend_extension="/usr/local/zend/lib/php_extensions/xdebug.so" 

[xdebug]
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.show_local_vars=0
xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20
xdebug.show_exception_trace=0

You don't need to use Zend Server however I find it's the best LAMP stack around. You can probably get by installing the default LAMP stack then installing XDebug

sudo aptitude install php5-xdebug
like image 122
Phil Avatar answered Dec 30 '25 15:12

Phil


The BitNami LAMPStack VMWare machine includes Xdebug and it is free. However, it does not include NetBeans but we know people have gotten it to work with the appliance.

like image 30
Josue Avatar answered Dec 30 '25 14:12

Josue



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!