Ubuntu下開啟php偵錯模式,顯示報錯資訊

來源:互聯網
上載者:User

標籤:etc   erro   處理   res   開發   資訊   restart   無法   service   

  在Ubuntu下php的預設設定是不顯示錯誤資訊的,如果程式出錯會顯示“無法處理此請求的錯誤提示”,這在開發環境下非常不方便。

  其實我們只要編輯下apache的設定檔就好

  1、我的apache 設定檔目錄是/etc/apache2/apache2.conf

  sudo vim /etc/apache2/apache2.conf

  再最後加入以下兩行

  php_flag display_errors        on
  php_value error_reporting       2039

  2、重啟apache  

  sudo service apache2 restart

  這樣就完成了錯誤資訊的顯示。

  註:如果還不可以就再改下php.ini下的配置(我沒有更改是可以顯示,因為上面添加的代碼已經開啟了)

  sudo vim /etc/php/7.0/cli/php.ini

  搜尋display_errors  預設是display_errors=Off  改成display_errors=On 儲存退出重啟apache2 即可

  

Ubuntu下開啟php偵錯模式,顯示報錯資訊

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.