The PHP file syntax error is not displayed on the webpage.

Source: Internet
Author: User
Tags derick php error
Php. ini error_reporting display_errors

In php. ini, I set display_errors = On and error_reportingE_ALL &~ E_NOTICE, and set php_flag display_errors on in httpd. conf.
Php_value error_reporting 2039
Run phpinfo. php to display these parameters normally, but the syntax error cannot be displayed on the webpage... I keep thinking that the reason may be that the php. ini file is not executed at all, so I wrote another file like this:
Ini_set ("display_errors", "On ");
Error_reporting (E_ALL );
Include ("test. php ");
?>
Here, test. php is the file with a syntax error. in this case, it will certainly work, and the result will not work yet...
Can someone help me...


Reply to discussion (solution)

So what is displayed?
What does this show?

 

Check whether php. ini is the one you modified in the results of phpinfo ();

Since it is test. php, paste it out.

Check whether php. ini is the one you modified in the results of phpinfo ();

Since it is test. php, paste it out.
The content of the test. php file is:
Echo "hello"
Echo "world ";
?>
That is, the first echo statement is followed by a semicolon.


Check whether php. ini is the one you modified in the results of phpinfo ();

Since it is test. php, paste it out.
The content of the test. php file is:
Echo "hello"
Echo "world ";
?>
That is, the first echo statement is followed by a semicolon.

The effective php. ini is indeed the one I modified.

So what is displayed?
What does this show?

 


Run the code on your top. The effect is the effect of network disconnection. if there is no prompt, My php file will be disconnected if there is an error.

Through phpinfo ();
Check whether your configuration is successful!

Through phpinfo ();
Check whether your configuration is successful!
Successful. the correct configuration is displayed.

Display_startup_errors

I guess whether the server converts all language errors to 500 errors, and then the client prompts "friendly", it looks like a network disconnection.

When an application fails, an error code is usually returned. The web server is not a fairy and cannot handle any application errors.
So as long as you do not return 0, I will return http 500 to the user (reject the response)

After the error display function display_errors = On is enabled for php
Although the php program is incorrect, it is correct for the web server. Because the application php generates an output, although it is a php error message. However, the web server does not care about the output content.

Display_startup_errors

I tried it too. no.

I guess whether the server converts all language errors to 500 errors, and then the client prompts "friendly", it looks like a network disconnection.
The 500 error seems to have occurred only when IIS is used. I am using Apache, and there is no such thing as an account or password.

When an application fails, an error code is usually returned. The web server is not a fairy and cannot handle any application errors.
So as long as you do not return 0, I will return http 500 to the user (reject the response)

After the error display function display_errors = On is enabled for php
Although the php program is incorrect, it is correct for the web server. Because the application php generates an output, although it is a php error message. However, the web server does not care about the output content.

Well, I don't understand. could you tell me in detail how to solve this problem? the previously configured LAMP environment can be displayed normally. Why can't I use AppServ...

Paste the result of phpinfo


I guess whether the server converts all language errors to 500 errors, and then the client prompts "friendly", it looks like a network disconnection.
The 500 error seems to have occurred only when IIS is used. I am using Apache, and there is no such thing as an account or password.


I guess whether the server converts all language errors to 500 errors, and then the client prompts "friendly", it looks like a network disconnection.
The 500 error seems to have occurred only when IIS is used. I am using Apache, and there is no such thing as an account or password.

Well, I just got it wrong. Apache can have a 500 error. The question is, how can I verify this idea?

Paste the result of phpinfo

PHP Version 5.2.6


System Windows NT YANYAOZHEN-D1 6.1 build 7600
Build Date May 2 2008 18:01:20
Configure Command cscript/nologo configure. js "-- enable-snapshot-build" "-- with-gd = shared" "-- with-extra-nodes des = C: \ Program Files (x86) \ Microsoft SDK \ Include; c: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ ATL \ INCLUDE; C: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ INCLUDE; C: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ MFC \ INCLUDE "" -- with-extra-libs = C: \ Program Files (x86) \ Microsoft SDK \ Lib; C: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ LIB; C: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ MFC \ LIB"
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php. ini) Path C: \ Windows
Loaded Configuration File C: \ Windows \ php. ini
Php api 20041225
PHP extension20060613
Zend Extension 220060519
Debug Build no
Thread Safety enabled
Zend Memory Manager enabled
IPv6 Support enabled
Registered PHP Streams php, file, data, http, ftp, compress. zlib
Registered Stream Socket Transports tcp, udp
Registered Stream Filters convert. iconv. *, string. rot13, string. toupper, string. tolower, string. strip_tags, convert. *, consumed, zlib .*

Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
With Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

PHP Credits

Configuration

PHP Core

Directive Local Value Master Value
Allow_call_time_pass_reference On
Allow_url_fopen On
Allow_url_include Off
Always_populate_raw_post_data Off
Arg_separator.input &&
Arg_separator.output &&
Asp_tags Off
Auto_append_file no value
Auto_globals_jit On
Auto_prepend_file no value
Browscap no value
Default_charset no value
Default_mimetype text/html
Define_syslog_variables Off
Disable_classes no value
Disable_functions no value
Display_errors On
Display_startup_errors Off
Doc_root no value
Docref_ext no value
Docref_root no value
Enable_dl On
Error_append_string no value
Error_log no value
Error_prepend_string no value
Error_reporting 2039 6135
Expose_php On
Extension_dir C:/AppServ \ php5 \ ext C:/AppServ \ php5 \ ext
File_uploads On
Highlight. bg # FFFFFF
Highlight. comment # FF8000 # FF8000
Highlight. default # niubb
Highlight.html #000000 #000000
Highlight. keyword #007700 #007700
Highlight. string # DD0000 # DD0000
Html_errors On
Ignore_repeated_errors Off
Ignore_repeated_source Off
Ignore_user_abort Off
Implicit_flush Off
Include_path.; C: \ AppServ \ php5 \ pear.; C: \ AppServ \ php5 \ pear
Log_errors Off
Log_errors_max_len1024 1024
Magic_quotes_gpc On
Magic_quotes_runtime Off
Magic_quotes_sybase Off
Mail. force_extra_parameters no value
Max_execution_time 30 30
Max_input_nesting_level 64 64
Max_input_time 60 60
Memory_limit 24 M 24 M
Open_basedir no value
Output_buffering no value
Output_handler no value
Post_max_size 80 M 80 M
Precision 12 12
Realpath_cache_size 16 K 16 K
Realpath_cache_ttl 120 120
Register_argc_argv On
Register_globals On
Register_long_arrays On
Report_memleaks On
Report_zend_debug On
Safe_mode Off
Safe_mode_exec_dir no value
Safe_mode_gid Off
Safe_mode_include_dir no value
Sendmail_from no value
Sendmail_path no value
Serialize_precision 100 100
Short_open_tag On
SMTP localhost
Smtp_port 25 25
SQL. safe_mode Off
Track_errors Off
Unserialize_callback_func no value
Upload_max_filesize 200 M 200 M
Upload_tmp_dir no value
User_dir no value
Variables_order EGPCS
Xmlrpc_error_number 0 0
Xmlrpc_errors Off
Y2k_compliance On
Zend. zemo-compatibility_mode Off


Paste the result of phpinfo

PHP Version 5.2.6


System Windows NT YANYAOZHEN-D1 6.1 build 7600
Build Date May 2 2008 18:01:20
Configure Command cscript/nologo configure. js "-- enable-snapshot-build" "-- with-gd = shared" "-- with-extra-nodes des = C: \ Program Files (x86) \ Microsoft SDK \ Include; c: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ ATL \ INCLUDE; C: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ INCLUDE; C: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ MFC \ INCLUDE "" -- with-extra-libs = C: \ Program Files (x86) \ Microsoft SDK \ Lib; C: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ LIB; C: \ PROGRA ~ 2 \ MICROS ~ 2 \ VC98 \ MFC \ LIB"
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php. ini) Path C: \ Windows
Loaded Configuration File C: \ Windows \ php. ini
Php api 20041225
PHP extension20060613
Zend Extension 220060519
Debug Build no
Thread Safety enabled
Zend Memory Manager enabled
IPv6 Support enabled
Registered PHP Streams php, file, data, http, ftp, compress. zlib
Registered Stream Socket Transports tcp, udp
Registered Stream Filters convert. iconv. *, string. rot13, string. toupper, string. tolower, string. strip_tags, convert. *, consumed, zlib .*

Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
With Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

PHP Credits

Configuration

PHP Core

Directive Local Value Master Value
Allow_call_time_pass_reference On
Allow_url_fopen On
Allow_url_include Off
Always_populate_raw_post_data Off
Arg_separator.input &&
Arg_separator.output &&
Asp_tags Off
Auto_append_file no value
Auto_globals_jit On
Auto_prepend_file no value
Browscap no value
Default_charset no value
Default_mimetype text/html
Define_syslog_variables Off
Disable_classes no value
Disable_functions no value
Display_errors On
Display_startup_errors Off
Doc_root no value
Docref_ext no value
Docref_root no value
Enable_dl On
Error_append_string no value
Error_log no value
Error_prepend_string no value
Error_reporting 2039 6135
Expose_php On
Extension_dir C:/AppServ \ php5 \ ext C:/AppServ \ php5 \ ext
File_uploads On
Highlight. bg # FFFFFF
Highlight. comment # FF8000 # FF8000
Highlight. default # niubb
Highlight.html #000000 #000000
Highlight. keyword #007700 #007700
Highlight. string # DD0000 # DD0000
Html_errors On
Ignore_repeated_errors Off
Ignore_repeated_source Off
Ignore_user_abort Off
Implicit_flush Off
Include_path.; C: \ AppServ \ php5 \ pear.; C: \ AppServ \ php5 \ pear
Log_errors Off
Log_errors_max_len1024 1024
Magic_quotes_gpc On
Magic_quotes_runtime Off
Magic_quotes_sybase Off
Mail. force_extra_parameters no value
Max_execution_time 30 30
Max_input_nesting_level 64 64
Max_input_time 60 60
Memory_limit 24 M 24 M
Open_basedir no value
Output_buffering no value
Output_handler no value
Post_max_size 80 M 80 M
Precision 12 12
Realpath_cache_size 16 K 16 K
Realpath_cache_ttl 120 120
Register_argc_argv On
Register_globals On
Register_long_arrays On
Report_memleaks On
Report_zend_debug On
Safe_mode Off
Safe_mode_exec_dir no value
Safe_mode_gid Off
Safe_mode_include_dir no value
Sendmail_from no value
Sendmail_path no value
Serialize_precision 100 100
Short_open_tag On
SMTP localhost
Smtp_port 25 25
SQL. safe_mode Off
Track_errors Off
Unserialize_callback_func no value
Upload_max_filesize 200 M 200 M
Upload_tmp_dir no value
User_dir no value
Variables_order EGPCS
Xmlrpc_error_number 0 0
Xmlrpc_errors Off
Y2k_compliance On
Zend. zemo-compatibility_mode Off

This is the above part of phpinfo, which is too long. so I only paste this part to see if there is any problem.

In httpd. conf
Php_flag display_errors on
Php_value error_reporting 2039

Delete them!

In httpd. conf
Php_flag display_errors on
Php_value error_reporting 2039

Delete them!
In fact, this is not used before, but because the webpage does not display an error, it is said that in httpd. the two parameters set in conf can overwrite php. I added these two lines to the configuration in ini, but now I have removed them. After I restarted the server, I still cannot run the wrong php program.

We recommend that you reinstall it and try again.

We recommend that you reinstall it and try again.
Okay...


We recommend that you reinstall it and try again.
Okay...

Sometimes, reinstallation is the most effective method without knowing why.

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.