Hướng dẫn php_flag display_errors off

I just want to only turn on PHP errors and disable all notices and warnings in PHP files.

Nội dung chính

  • Warning Cakephp là gì?
  • Các bước thực hiện ẩn cảnh báo lỗi Cakephp như sau
  • Bước 1: Login Hosting trên trình duyệt
  • Bước 2: Xác định đường dẫn đến thư mục cần chỉnh sửa
  • Bước 3: Tìm và chỉnh sửa đoạn mã ẩn cảnh báo
  • Bước 4: kiểm tra lại

Hướng dẫn php_flag display_errors off

asked Dec 28, 2011 at 7:07

1

It is probably not the best thing to do. You need to at least check out your PHP error log for things going wrong ;)

# PHP error handling for development servers
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
php_flag report_memleaks on
php_flag track_errors on
php_value docref_root 0
php_value docref_ext 0
php_value error_log /home/path/public_html/domain/PHP_errors.log
php_value error_reporting -1
php_value log_errors_max_len 0

answered Dec 28, 2011 at 7:14

impimp

1,0907 silver badges13 bronze badges

5

If you are in a shared hosting plan that doesn't have PHP installed as a module you will get a 500 server error when adding those flags to the .htaccess file.

But you can add the line

ini_set('display_errors','off');

on top of your .php file and it should work without any errors.

answered Sep 9, 2012 at 1:05

FortesFortes

91812 silver badges23 bronze badges

Try:

php_value error_reporting 2039

answered Dec 28, 2011 at 7:14

Sudhir BastakotiSudhir Bastakoti

97.8k15 gold badges156 silver badges161 bronze badges

5

Fortes is right, thank you.

When you have a shared hosting it is usual to obtain an 500 server error.

I have a website with Joomla and I added to the index.php:

ini_set('display_errors','off');

The error line showed in my website disappeared.

answered Apr 17, 2013 at 8:53

RichRich

691 silver badge1 bronze badge

Use:

ini_set('display_errors','off');

It is working fine in WordPress' config.php.

answered Dec 4, 2015 at 5:10

2

I used ini_set('display_errors','off'); and it worked great.

answered Apr 30, 2013 at 14:33

Warning Cakephp là gì?

Với các mã nguồn sử dụng Cakephp, điều thường gặp đó là các cảnh báo. Cảnh báo này nhằm mục đích cho lập trình viên biết lỗi ở đâu để khắc phục (debug). Tuy nhiên với các code cũ, thường ít ai fix triệt để các Warning này. Vì vậy Bạn cần ẩn nó đi để không ảnh hưởng đến giao diện website.

website lỗi nhìn sẽ như thế này!

Các bước thực hiện ẩn cảnh báo lỗi Cakephp như sau

Bạn cần có quyền truy cập Hosting / FTP / SSH để sửa nhé

ở hướng dẫn này, mính sẽ demo trên giao diện web Hosting DirectAdmin

Bước 1: Login Hosting trên trình duyệt

Điều này khỏi cần hướng dẫn nhé. các Bạn tự login vào Hosting

Với FTP và SSH các Bạn cũng login nha

Bước 2: Xác định đường dẫn đến thư mục cần chỉnh sửa

Thường thì config sẽ nằm trong đường dẫn này

app/Config/core.php

tất nhiên đây là đường dẫn trong thư mục public_html nhé. Hãy chọn cho đúng tên miền cần chỉnh sửa nếu Bạn có nhiều tên miền. Tránh nhầm lẫn nha

Một số lập trình viên chỉnh sửa thì Bạn tự tìm file tương ứng nhé

Bước 3: Tìm và chỉnh sửa đoạn mã ẩn cảnh báo

Như ảnh bước 2, các Bạn click vào nút “edit” của hàng core.php

Sau đó dùng tổ hợp phím crtl + F (tìm kiếm) và paste vào cụm từ này “Configure::write('debug'

Sau đó chỉnh sửa “2” thành “0”

Bước 4: kiểm tra lại

Hãy truy cập website xem đã hết lỗi chưa nhé

Nếu chưa, vui lòng chat với kỹ thuật tại HostingViet.vn

Chúng tôi luôn trực 24/24 để hỗ trợ Quý khách và các Bạn

Chúc các Bạn thành công!

Trung – Kỹ thuật viên HostingViet