라이브러리

[PHP_CONFIG] html_errors - HTML 형식의 오류 메시지 출력 여부




PHP CONFIG 에서 html_errors는 PHP가 HTML 오류를 출력할지 여부를 결정하는 설정입니다. 이 설정은 PHP의 실행 환경에서 오류를 발생시키고, PHP가 오류를 출력할 때 HTML 오류를 포함할지 여부를 결정합니다.

html_errors 설정의 기본값

html_errors의 기본값은 `On`입니다. 이 설정을 사용하면 PHP가 HTML 오류를 출력할 것입니다.

html_errors 설정의 가능한 값

html_errors 설정에는 두 가지 가능한 값이 있습니다.

- `On`: PHP가 HTML 오류를 출력합니다.
- `Off`: PHP가 HTML 오류를 출력하지 않습니다.

html_errors 설정의 예제

#hostingforum.kr
php

// php.ini 파일에서 html_errors 설정

html_errors = Off



// 또는 PHP 코드에서 html_errors 설정

ini_set('html_errors', 'Off');



html_errors 설정의 효과

html_errors 설정의 효과는 PHP가 HTML 오류를 출력할지 여부를 결정합니다. 예를 들어, PHP가 HTML 오류를 출력하지 않도록 설정하면, PHP가 오류를 발생시키더라도 HTML 오류를 출력하지 않을 것입니다.

#hostingforum.kr
php

// html_errors가 On인 경우

<?php

echo $non_existent_variable;

?>



// 출력 결과

Notice: Undefined variable: non_existent_variable in /path/to/script.php on line 2



#hostingforum.kr
php

// html_errors가 Off인 경우

<?php

echo $non_existent_variable;

?>



// 출력 결과

Undefined variable: non_existent_variable



html_errors 설정의 사용 사례

html_errors 설정은 개발 환경에서 유용합니다. 개발 환경에서 HTML 오류를 출력하지 않으면, 개발자는 오류를 더 쉽게 찾을 수 있습니다. 또한, production 환경에서 HTML 오류를 출력하지 않으면, 오류가 노출되지 않습니다.

#hostingforum.kr
php

// 개발 환경에서 html_errors 설정

ini_set('html_errors', 'On');



// production 환경에서 html_errors 설정

ini_set('html_errors', 'Off');



html_errors 설정의 참고 자료

- PHP Manual: [html_errors](https://www.php.net/manual/ko/ini.core.php#ini.html_errors)
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 10,077건 / 1 페이지

검색

게시물 검색