1. ภาพรวมของ Joomla Error Reporting
Error Reporting เป็นตัวช่วยสำคัญของ Joomla ที่ช่วยในการแก้ไข PHP error บนเว็บไซต์ Joomla ของเรา โดยที่ ฟังชัน นี้มีการแจ้งเกี่ยวกับจุดที่ผิดและจุดทีเป็นปัญหา เกี่ยวกับโค้ด PHP
2.เมื่อไรควรจะเปิด Function นี้ ??
เมื่อบางที ทีคุณทำการติดตั้ง Extension ลงไปแล้ว เกิดการแสดง หน้าเปล่า หรือ หน้าสีขาวๆเปล่า เพื่อทำการหาจุดทีผิดของ โค้ด โดยจะทำการเปิด Function นี้ :3
3. วิธีการเปิดใช้งาน ให้ไปที Global Configuration >> Server tab >> Error Reporting.
ความหมายของ ตัวเลือก Error Reporting
ความหมายของตัวเลือก Error Reporting จะมีดังนี้
- System Default : Joomla จะทำการยึดการตั้งค่า Error ตาม Default Server (ในไฟล์ php.ini)
- None : เลือก option นี้ คือปิดการแสดง Error ทุกอัน
- Simple : การตั้งค่าพื้นฐานเพื่อให้รายงานความผิดพลาด พื้นฐานของการแจ้งเตือน Error
- Maximum : รายงานความผิดพลาด ต่างๆทั้งหมด คำเตือนประกาศฟังชั่นมาตรฐานที่เข็มงวดในเว็บไซต์
- Development : เหมาะสำหรับนักพัฒนาเพราะ ตัวเลือกนี้ จะแสดง Error เกี่ยวกับการพัฒนาอยู่ตลอดเวลา
Tip : คุณสามารถจัดการ Error Reporting ได้ที่ไฟล์ Configuration.php และทำการแก้ไขไฟล์ ในบรรทัด $error_reporting แล้วแทนค่าพวกนี้อันใดอันหนึ่งลงไป
- -1 = 0 : No error reporting.
- 30711 = E_ALL & ~(E_NOTICE|E_WARNING) : All errors reporting. No warnings or notices.
- 30711 = E_ALL & ~E_NOTICE : All errors and warnings reporting. No notices.
- 30719 = E_ALL : All errors, warnings and notices reporting.
- 32767 = E_ALL | E_STRICT : All errors, warnings, notices and strict standards reporting.
ตัวอย่าง - เปิดไฟล์ yoursite/component/com_content/content.php แล้วทำการลบเครื่องหมาย ; ออก
<?php /** * @package Joomla.Site * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * Define the application's minimum supported PHP version as a constant so it can be referenced within the application. */ define('JOOMLA_MINIMUM_PHP', '5.3.10') //<< ลบเครื่องหมาย ; ออกที่บรรทัด 12 if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) { die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this version of Joomla!'); } // Saves the start time and memory usage. $startTime = microtime(1); $startMem = memory_get_usage(); /** * Constant that is checked in included files to prevent direct access. * define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower */ define('_JEXEC', 1);
- ตรวจสอบการตั้งค่า Error Reporting ตั้งให้ None มันจะได้ผลเป็นหน้าสีขาวเปล่าๆ
- ต่อไปเปลียนให้เป็น Maximum แล้วจะเห็น Error ตามภาพ
ถ้าได้ Error แล้วแก้ไขไม่หาย สอบถามได้ที่เว็บบอร์ด