How to debug PHP, how to check the wrong?

Source: Internet
Author: User
How to debug PHP, how to check the wrong??
PHP as long as there is a little error, the entire page is not displayed, if require_once, the referenced file is wrong, also shows 500 error
I think, a experienced software engineer, also can not be in the grammar of the main error, if the page is large, not to find dead??

Share to:


------Solution--------------------
Not really.
Because if something goes wrong, the error message such as Fatal error:call to undefined function pages () and "URL" on line 48 is displayed on the Web page, and the 48th row is accurate, but I'm a mistake that PHP novice may have experienced Rarely..
------Solution--------------------
Open the error display function of PHP (at least in the debug environment you need to do so)

------Solution--------------------
① use built-in functions for troubleshooting, such as echo,var_dump,print these are common
② local breakpoint debugging with Zendstudio Xdebug plug-in

That's all I got. The pure hand hit has the wood to have!
------Solution--------------------
What is not realistic is because PHP.ini's display_error set the cause.
Also, you can see that the error log is usually written under Apache error logs.

This is generally recommended: the development environment is open for easy commissioning
On-line environment shutdown: Prevent code from being seen by others
------Solution--------------------
I am studying mainly to see the video tutorials of the Hanshunping podcast PHP teacher. Watch him in the video, to write one side of the test, so the heart more practical. So many error log usage also do not understand, only know how to write a little test must be. This will not cause the code after writing, can not run, but also a headache to find the wrong.
------Solution--------------------
You can use the Eclipse Editor to automatically prompt for any errors.
------Solution--------------------
Check the log, there will be the first few lines of error records.
  • 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.