Yosemite Intellij idea PHP Setup xdebug single-Step debugging

Source: Internet
Author: User
PHP Setup Single-Step debugging

Always look at PHP syntax, recently looked like a fire laravel, there is a laravel/framework based on the OCTOBERCRM, has not found a way to do single-step debugging, today finally reached.

IDE with the IntelliJ Idea,android Studio is based on this thing, but also because of Android studio I began to touch the IDE, and later see PHP, put a plug-in, called PHP Bar, and then write PHP code, hints do very good, I generally use the IDE to look at two content, one is the hint, the second is debug,debug today, can be single step.

I chose the xdebug, no why, I happened to search http://nixmash.com/php/configuring-php-debugging-in-intellij-idea-with-xdebug/this article, My goal is only to be able to single-step debugging.

1, installation Xdebug, specific installation and installation reference http://xdebug.org/wizard.php, only need to put your local phpinfo () content to that URL analysis, you can also >php-i output the same information, You can follow the step by step installation, so easy!

2, configure Xdebug, follow the first step to install the Xdebug, it has taught you in the php.ini configuration, but need to add a xdebug.remote_enable=on, this in the validation of the time, the other configuration items using the default is good.

3,>sudo apachectl Restart, restart Apache and you'll be able to see the xdebug information.

4, build a blank PHP project.

5, create a new PHP file, write some statements, you can use HTML embedded PHP format, or a pure PHP, can be.

Like what:

<HTML>
<head>
<title>debug php title>
Head>
<body>
<P>3+5= p>
<br/>
$a = 1;
$b = 2;
echo $a + $b;
?>
Body>
Html>

Very simple addition, in the $b=2; the line breaks a breakpoint, and it will be parked here when it is brought back.

6. Run->edit configurations in the menu, or in the menu bar, open

Painted red is my user name, do not show you, configure Yosemite AMP environment, you can use this configuration, apache/php can not install a MySQL, you can refer to HTTP. coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/, I can't remember the link I used at the time, please forgive me, Seems to use homebrew installed MySQL, so you have to start manually, of course, I do not like to start automatically, after all, I do not develop this every day. PHP extension MCrypt is to be installed separately, homebrew can also be done, the other seems to have.

Well, say back to IntelliJ configuration, upper left corner + add a php Web Application,name can be entered casually. The Start URL corresponds to the can open on the line. Behind server ... Open it:


Add a server, port number note that later Laravel default is 8000, the system default is 80.

Validate Remote Environment Open. This is important.

7, you can see the following page:

Information is shown after I press validate, this is the case when the local configuration is correct. As a matter of fact, I >php artisan serve with laravel under the test.

8. Open Deployment Server:

As follows:


Here choose in place, browse page can fill in your page, Laravel can directly fill in http://localhost:8000, OK, here is finished.

That's what happens after 8,ok.

9, reference Https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug +and+phpstorm

, Fourth step: Activate Debugger on server

10, you can see the following on your Chrome live Firefox:

You have to click on Start debugger, then refresh the page, you can see your IntelliJ breakpoint stopped, good, now you can step into debugging.

PS: As I mentioned in the article, lavaral use >php artisan serve can be very easy to start the project, the project you can refer to learnlaravel5 that, the official website has a tutorial. I am also a step-by-step. After this command, you can access http://localhost:8000 directly through Chrome, and OCTOBERCRM is the same.

The entire Setup debug step is the same, is validate pass, or I am in the configuration learnlaravel without PHP artisan serve boot, But I'm still not configured well. Htacess,apache has a lot of configuration I do not understand, well, first so do not care so much, now regardless of how the final deployment to the server, now development can be normal.

I hope you can help me with the above content.



Reference:

http://xdebug.org/wizard.php

http://nixmash.com/php/configuring-php-debugging-in-intellij-idea-with-xdebug/

Https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm

  • 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.