NOTES: Configuring PHP Development, debugging environment under MAC OS X

Source: Internet
Author: User
Tags php debug php debugger php website

Operating system: MAC OS X

Tools: MAMP, Phpstorm, Xdebug, Chrome

1. Download Mamp

2, installation is relatively simple, after installation, the application will add the following 4 applications

  

MACGDBP is the PHP debugger, using the Xdebug

To use this debugger, you need to configure it in php.ini:

  

[Xdebug]zend_extension= "/applications/mamp/bin/php/php5.5.10/lib/php/extensions/ No-debug-non-zts-20121212/xdebug.so "xdebug. remote_enable=1xdebug. remote_host=  Localhostxdebug. remote_port=9000xdebug. remote_autostart=1

Zend_extension is set according to the specific version and path of PHP that you use.

The Xdebug.remote_port port is to be the same as the port set in the MACGDBP preferences.

  

After the two-step configuration is completed, open macgdbp, Browser input PHP site address, in the execution of the first line of PHP code to automatically enter the debugging state, that is, the first line of PHP code automatically load breakpoints.

  

Mamp is used to start the Apache and MySQL services as shown in:

  

Clicking Start servers will launch the Apache and MySQL services as shown in:

  

Click the Open Start Page to open the Admin interface for viewing phpinfo and phpMyAdmin management tools such as MySQL.

Click on Preferences to configure Apache and MySQL ports, as well as PHP version information.

3, Mysqlworkbench and sequel Pro are MySQL management tools, can be used according to the actual situation.

4, download and install Phpstorm, I installed the 7.1.3 version.

5, in php.ini [Xdebug] Add the following line, the value of Xdebug.idekey can be arbitrarily set, I set the phpstorm.

xdebug.idekey= "Phpstorm"

6, open the Phpstorm preferences, find the debug under PHP, configure debug port for the 2nd step in the above php.ini set the Ports 9000, other by default settings.

  

7, browser configuration, Chrome browser Installation Xdebug Helper

Once installed, click on Chrome's [Settings] menu and click [Extensions]

  

Then click on the xdebug helper option

    

Set the IDE Key, select Other in the drop-down list, enter Phpstorm (that is, the xdebug.idekey we set in the php.ini in the previous step), and then click the Save icon when you have finished typing.

We can also select Phpstorm directly from the drop-down list.

8. Debug Program

Click Phpstorm Menu Run, start Listen PHP Debug Connections turn on monitoring

In the Phpstom development environment, set breakpoints at a line of code in PHP

In Chrome, enter the address of your PHP website and debug at the breakpoint you set.

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.