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 information in windows, I tried to build the debugging environment successfully. Configuration process: install xdeb... SyntaxHighlighter. all (
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 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