PHP 500 Internal Server Error 해결

프리터코더·2025년 5월 25일
0

php 문제 해결

목록 보기
2/79

문제 개요

500 Internal Server Error는 서버 측에서 발생하는 일반적인 오류로, PHP 애플리케이션에서 자주 발생하는 문제입니다.

주요 원인과 해결방법

1. 파일 권한 문제

chmod 755 /var/www/html
chown www-data:www-data /var/www/html

2. .htaccess 설정 오류

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

3. PHP 메모리 제한

memory_limit = 256M
max_execution_time = 300

4. 로그 확인 방법

tail -f /var/log/apache2/error.log
tail -f /var/log/php_errors.log

디버깅 단계

1. 에러 로깅 활성화

ini_set('display_errors', 1);
error_reporting(E_ALL);

2. PHP 버전 호환성 체크

<?php
phpinfo();
?>

3. 서버 재시작

systemctl restart apache2
systemctl restart php-fpm
profile
일용직 개발자. freetercoder@gmail.com

0개의 댓글