PHP 에러메시지 안보이게 하기 - Knowledgebase 해외서버 - MEGA IDC

PHP 에러메시지 안보이게 하기 Print
  • 0

안녕하세요? MEGA IDC 서버운영팀입니다.

PHP는 기본적으로 웹상에 에러 메시지를 표시하지 않도록 설정되어 있습니다.
PHP 파일에 오류가 있을 경우, 아무런 메시지도 나타나지 않습니다.
소스코드가 노출되면 보안상 위험할 수 있으므로 보여주지 않는 것이 기본값 입니다.
대신 /var/log/httpd/error_log에서 확인할 수 있습니다.

웹브라우저에 보이게 하고 싶다면 아래와 같이 /etc/php.ini를 수정해주시면 됩니다.

php.ini 수정

vi /etc/php.ini

변경 전
; Print out errors (as a part of the output). For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below). Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
display_errors = Off

변경 후
; Print out errors (as a part of the output). For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below). Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
display_errors = On

httpd 재시작
변경한 php.ini가 실제로 웹에 적용되게 하려면 httpd를 재시작해야 합니다.
service httpd restart

이제 오류가 있는 PHP를 호출하면 오류 메시지가 보일 것입니다.

서비스 이용에 관련된 문의는 지원팀으로 문의주시면 자세히 안내해드리겠습니다.
감사합니다.


Was this answer helpful?
« Back