簡體   English   中英

發生錯誤時,php返回頁面不顯示錯誤消息

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

我已經安裝了Apache2.4和PHP7.2.2

我調試了一些php頁面,它們出現了錯誤,返回頁面顯示了錯誤消息

然后我編輯了httpd.conf,更改了行

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>

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

然后,當頁面有錯誤時,它僅顯示從頁面開始到該行的內容有錯誤,但不顯示錯誤消息

我已將路徑更改回“ C:\\ Apache24 \\ htdocs”,但仍然存在問題

誰能幫忙

謝謝閱讀。

為了顯示您必須配置您的PHP不是Apache服務器您可以使用一些php內置函數來顯示錯誤或更改配置文件

使用PHP

您已在PHP文件的根目錄中添加了以下代碼

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

使用php.ini文件

在您的PHP安裝中找到php.ini文件並打開它,搜索display_errors變量並設置值為On

display_errors=On

然后重啟服務器

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM