Netbeansxdebug debugging PHP code _ PHP Tutorial on MAC

Source: Internet
Author: User
Debug PHP code in netbeansxdebug on MAC. Today, I tried to debug the PHP code on a MAC and found that netbeans could not be connected to a breakpoint, but it could not be debugged at all. Some searches found a third-party PHP module called xdebug. although I only found some third-party modules under windows today and on MAC, I wanted to debug the PHP code. I found that netbeans could not be mounted to a breakpoint, but it could not be debugged at all. Some searches found a third-party PHP module called xdebug. although I only found some information in windows, I tried to build the debugging environment successfully.

Configuration process:

Install xdebug

Modify php. ini

Restart apache

Verify that the debugging port of netbeans is consistent with that of xdebug.

(1) Download xdebug

I used brew here. if you are not familiar with brew, you can Google it.

First, perform a habitual search:

Run the command in the terminal: brew search xdebug found that there is indeed a software xdebug.

Then brew install xdebug to make the trip smooth. A prompt is displayed after installation.

Don't remember. it's okay: brew info xdebug

[Hechangmin @ hecm-mac ~] $ Brew info xdebug

Xdebug 2.1.2

Http://xdebug.org

/Usr/local/Cellar/xdebug/2.1.2 (348 K)

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 CILS "phpinfo ();"

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

* If you see it, you have been successful!

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

We have a prompt to modify php. ini. this is the second step.

(2) modify the php. ini file

The default path is sudo vi/Applications/XAMPP/etc/php. ini because of the xmapp I installed.

Added:

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

Log on to the terminal as the system administrator root:

Sudo su

Run 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 the nb debugging port

Open netbeans, select preference settings, and select Port 9000 in the debugger, as shown in step 2. And select 'stop in the first line '(optional) to prevent running directly when a breakpoint is triggered.

This completes all. Note that when creating a PHP project, you will be asked to select the hosts to be debugged. remember to make sure that the url to be debugged is correct.

Author-274 °C

The producer cannot be mounted to a breakpoint and cannot be debugged at all. Some searches found a third-party PHP module called xdebug, although only some windows...

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.