Xdebug Debugging PHP Code _php Tutorial in NetBeans under MAC

Source: Internet
Author: User
Tags netbeans
Today, under the Mac, want to debug PHP code, found that NetBeans can not hang breakpoints, the basic debugging. A search found that there is a third-party PHP module called Xdebug, although only to find some information under Windows, but still feel the debugging environment to build success.

Configuration process:

Installing Xdebug

Modify PHP.ini

Restart Apache

Verify that NetBeans's debug port is consistent with Xdebug

(1) Download Xdebug

I used brew here, if not familiar with the brew tool can Google under.

First the habitual search under:

Execute command in Terminal: Brew search Xdebug found a software xdebug.

Then brew install Xdebug, Bon voyage. Installation is complete with a prompt to install the situation.

It's okay to remember: Brew info xdebug

[Hechangmin@hecm-mac ~] $brew Info xdebug

Xdebug 2.1.2

http://xdebug.org

/usr/local/cellar/xdebug/2.1.2 (348K)

To use this software:

* Add the following line to PHP.ini:

zend_extension= "/usr/local/cellar/xdebug/2.1.2/xdebug.so"

* Restart your webserver.

* Write a PHP page that calls "phpinfo ();"

* Load it in a browser and look for the info on the Xdebug module.

* If You are there been successful!

Http://github.com/mxcl/homebrew/commits/master/Library/Formula/xdebug.rb

Let's see if we can change php.ini, and that's the second step we're going to take.

(2) Modify the php.ini file

Because I installed the Xmapp, I found the default path: sudo vi/applications/xampp/etc/php.ini

Increase:

zend_extension= "/usr/local/cellar/xdebug/2.1.2/xdebug.so"

Xdebug.remote_enable=1

Xdebug.remote_host=localhost

xdebug.remote_port=9000

Xdebug.remote_handler=dbgp

(3) Restart Apache

Under Terminal, log in as system administrator root:

sudo su

Use the following command to start XAMPP:

/applications/xampp/xamppfiles/xampp start

You should be able to see a message similar to the following on the screen:

Starting XAMPP for MacOS X 1.7.3 ...

Xampp:starting Apache with SSL (and PHP5) ...

Xampp:starting MySQL ...

Xampp:starting ProFTPD ...

XAMPP for MacOS X started.

(4) Confirm NB Debug Port

Open NetBeans, select Preferences, and select Port 9000 in the debugger port, as in the second step. and tick ' stop at the first line ' (optional), this is to prevent the break point to run out of direct.

This is all done. One thing to note is that when you create a PHP project, you will be asked to choose the hosts to debug, remember to debug the URL to write the wrong.

Author -274°c

http://www.bkjia.com/PHPjc/478521.html www.bkjia.com true http://www.bkjia.com/PHPjc/478521.html techarticle today, under the Mac, want to debug PHP code, found that NetBeans can not hang breakpoints, the basic debugging. A search found that there is a PHP third-party module called Xdebug, although only found some windows under ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.