How to Debug php programs?

Source: Internet
Author: User
Tags parse error
How to Debug php programs? Gedit + Mozilla Firefox

 


Use the above Notepad + browser for debugging.
If a part of the php program fails, the results of the entire program may not be displayed in the browser.
In this way, it is difficult to find program errors.
Is there any way to solve this problem?


Reply to discussion (solution)

Enable the php error prompt function
Set display_errors = On in php. ini and restart the server.

If the error display function is not enabled, any php error will cause a 500 error (the server rejects the response)

$ Y = a1.0;
Syntax error! Parse error: syntax error, unexpected '. 0' (T_DNUMBER)

Enable the php error prompt function
Set display_errors = On in php. ini and restart the server.

1. in which directory?
2. how to restart the server?

Write in your php file:
Phpinfo ();

Find the Loaded Configuration File and modify the php. ini File it loads.

To restart the service, you can open your system service list, find apache, restart the service, or run the command line.

Write in your php file:
Phpinfo ();

Find the Loaded Configuration File and modify the php. ini File it loads.

To restart the service, you can open your system service list, find apache, restart the service, or run the command line.

1. which directory does php. ini belong?
2. what is the restart command?

In your program? Join department ?? You do not need to modify php. ini.

Error_reporting (E_ALL );
INI_Set ('display _ errors ', 'on ');


Write in your php file:
Phpinfo ();

Find the Loaded Configuration File and modify the php. ini File it loads.

To restart the service, you can open your system service list, find apache, restart the service, or run the command line.

1. which directory does php. ini belong?
2. what is the restart command?

Aren't you in windows?
Php. ini is generally in the root directory of the php folder.
Restart apache directly in the "system service" list and restart sibang. you can simply do it.

To open the System Service list, right-click "computer" or "My Computer" and choose "manage"> "service ".

If the directory cannot be found in windows, will it not be used to find the file?



Write in your php file:
Phpinfo ();

Find the Loaded Configuration File and modify the php. ini File it loads.

To restart the service, you can open your system service list, find apache, restart the service, or run the command line.

1. which directory does php. ini belong?
2. what is the restart command?

Aren't you in windows?
Php. ini is generally in the root directory of the php folder.
Restart apache directly in the "system service" list and restart sibang. you can simply do it.

To open the System Service list, right-click "computer" or "My Computer" and choose "manage"> "service ".

Ubuntu

Sorry, I have read the wrong post. you are not in windows.

Sorry, I have read the wrong post. you are not in windows.

/

Sorry, I have read the wrong post. you are not in windows.


,

Sorry, I have read the wrong post. you are not in windows.

,

Pay attention to the seventh line of the code. Is this a string value assignment or? Otherwise, as stated in #2, an unknown error (such definition does not exist ). If the value is a string, it is written as follows: $ y = 'a1. 0 ';

Enable the php error prompt function
Set display_errors = On in php. ini and restart the server.

Ubuntu system
1. where is the php. ini file located?

2. what is the restart server command?

I don't know if your php is built or compiled later. search for it on the internet. I am not very familiar with linux.

Create a file, such as info. php

   
View the two items after running
Configuration File (php. ini) Path (default php. ini Path)
Loaded Configuration File (the actual php. ini path)

Create a file, such as info. php

    
View the two items after running
Configuration File (php. ini) Path (default php. ini Path)
Loaded Configuration File (the actual php. ini path)
Boss, is there something missing from my question? Unable to continue?

Didn't I say that in #2?
That is a syntax error! If the error is not displayed, the error 500 is displayed.
If you set the error log, it will not be displayed. However, you can see the error message in the error log.
In short, when a syntax error occurs, php exits.



Create a file, such as info. php

     
View the two items after running
Configuration File (php. ini) Path (default php. ini Path)
Loaded Configuration File (the actual php. ini path)
Boss, is there something missing from my question? Unable to continue?

Didn't I say that in #2?
That is a syntax error! If the error is not displayed, the error 500 is displayed.
If you set the error log, it will not be displayed. However, you can see the error message in the error log.
In short, when a syntax error occurs, php exits.




Create a file, such as info. php

      
View the two items after running
Configuration File (php. ini) Path (default php. ini Path)
Loaded Configuration File (the actual php. ini path)
Boss, is there something missing from my question? Unable to continue?
Not this post...
Please move: http://bbs.csdn.net/topics/390507272



Write in your php file:
Phpinfo ();

Find the Loaded Configuration File and modify the php. ini File it loads.

To restart the service, you can open your system service list, find apache, restart the service, or run the command line.

1. which directory does php. ini belong?
2. what is the restart command?

Aren't you in windows?
Php. ini is generally in the root directory of the php folder.
Restart apache directly in the "system service" list and restart sibang. you can simply do it.

To open the System Service list, right-click "computer" or "My Computer" and choose "manage"> "service ".


,,,

In your program? Join department ?? You do not need to modify php. ini.

Error_reporting (E_ALL );
INI_Set ('display _ errors ', 'on ');

This method does not work either.
The mozilla firefox browser shows nothing.

Create a file, such as info. php

       
View the two items after running
Configuration File (php. ini) Path (default php. ini Path)
Loaded Configuration File (the actual php. ini path)

1. create a new file: info. php. where is this file stored?
2. do I have to modify the File: php. ini?

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.