简体   繁体   中英

The php return page does not show error message when error is occured

I have already installed Apache2.4 and PHP7.2.2

I debugged some php page, they had error, and the return page have displayed error messages

Then I edited the httpd.conf, changed the lines

DocumentRoot "C:\Apache24\htdocs"
<Directory "C:\Apache24\htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

to

DocumentRoot "D:\mywebs"
    <Directory "D:\mywebs">

then when a page has error, it only displayed the content from the begin of the page to the line has error but it does not show error message

I had change the path back to "C:\\Apache24\\htdocs" but there still have been the problem

Can anyone help

Thanks for reading.

For displaying you have to configure you PHP not apache server You can use some php inbuilt function to show error or change the configuration file

Using PHP

You have add below code in root of the PHP file

<?php
  ini_set('display_errors', 1);
  error_reporting(E_ALL);
?>

Using php.ini file

Find php.ini file in your PHP installation and open it, Search display_errors variable and set value On

display_errors=On

And then restart server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM