Debug php on mac?

was wondering what was the best way to debug PHP on my local machine. I am using MAMP on mac os 10.5

thanks patrick

+3
source share
8 answers

Using xdebug is a good start. Download the package and follow the instructions in the file INSTALL. This is pretty easy. Once this is done, add the following lines to your file php.ini:

;;[xdebug]
zend_extension="/Path/to/your/module/xdebug.so"
xdebug.file_link_format="txmt://open?url=file://%f&line=%1"
xdebug.var_display_max_depth = 20

Remember to restart Apache after this.

Most debugging can be done with a simple one die(var_dump($some_variable)). It's not very complicated, but with xdebug installed, the vardump output looks pretty good in the browser. In most cases, this is enough.

, xdebug_break(); php.ini:

xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1

, Apache.

, , MacGDBp ( Eclipse + PDT, ), . , .

!

+3

, "" PHP - FirePHP, Firebug Firefox.

+1

, php -l myfile.php , (, , ). , - .

(, debug_backtrace()), () , .

+1

Eclipse + PDT XDebug. , Eclipse PHP Eclipse, PDT . Eclipse , , : , , , .

Eclipse , clients, XDebug.

+1

eclipse + pdt xdebug. , zend studio, .

0

Zend Studio, , PHP-. Edition Zend Server Linux MacBook Pro.

Zend - !

0

, , , Apache2 XDebug OSX MacGDBp Safari, XDebug Helper.

0

MAMP.

, , :

1) php debug

brew install php70
brew install php70-xdebug
  • PhpStorm - Preferences = > Frameworks = > PHP Php: 7 : PHP 7.0.8 + XDebug ( [...])

  • : = > = > PHP = > = > Xdebug : 9001

2) :

php -S localhost:8080

3) localhost: 8080 PhpStorm Preferences = > Frameworks = > PHP = > : : Localhost: 8080 : localhost : 8080 : Xdebug

4) php.ini: Php = > Interpreter = > [...] = > - : ( zend_extention cli)

[Xdebug]
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9001 (same as in Debug preferences)

5) : Run = > Edit Configuration = > add - Php Web Application

  • Localhost: 8080

6) " " Php Debug Connections 7) 7) "" ( " " )

0
source

Source: https://habr.com/ru/post/1722213/


All Articles