개발! 딱 깔끔하고 센스있게!

Apache 비기록 php 오류 본문

개발 스크랩 메모/PHP

Apache 비기록 php 오류

렉사이 2020. 12. 28. 02:42

PHP via CLI 는 잘못된 기록을 / var / log / PHPu errors.log 에 성공적으로 기록했습니다.

하지만 apache + phphp은 오류를 기록하지 않습니다.

[[email protected] ~]$ apachectl -v Server version: Apache/2.2.17 (Unix) Server built: May 19 2011 03:15:39 [[email protected] ~]$ php -v PHP 5.3.6 with Suhosin-Patch (cli) (built: Mar 23 2011 13:28:00) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies 

php.In I 에서 나는 있다:

display_errors = On error_reporting = E_ALL | E_STRICT log_errors = On error_log = php_errors.log 

httpd.conf 에서:

ErrorLog "/var/log/httpd/error_log" 

권한:

[[email protected] /]$ ls -la /var/log/httpd/ -rwxrwxr-x 1 root root 133351 21.11.2011 11:18 access_log* -rwxrwxr-x 1 root http 1307 21.11.2011 11:18 error_log* [[email protected] /]$ ls -la /var/log/php_errors.log -rwxrwxr-x 1 root http 521 14.11.2011 17:31 /var/log/php_errors.log* 

보시다시피 Apache 데몬을 로그 파일에 쓰기 권한이 있습니다.

Apache 나 PHP 는 / var/ log/ PHPu errors.log 과 / var/ log/ httpd/ error log 속에서도 잘못이 없습니다.

업데이트

php.ini 에서 이 줄 변경:

error_log = php_errors.log 

전체 경로:

error_log = /var/log/php_errors.log 

권한이 정상이다.

그러나 누군가도 문제가 있다면 로그 파일 077777에 대한 설정 권한을 바꾸거나 파일 소유자를 변경할 수 있습니다.

대답

Apache 와 CLI 에 대해 일반적으로 두 개의 단독 php.ini 파일이 있습니다.

- 정확한 파일을 찾고 있습니까?

편집:

그리고 제가 생각할 수 있는 선택이 두 개 있습니다:

  • some Apache directive is messing with PHP's log path (or disabling the logging options, though that is very unlikely to be the case) - try setting an absolute path to the log file in php.ini (@Frosty Z has suggested something like this)
  • I notice that your PHP installation has the Suhosin patch applied, which does several restrictive modifications in order to improve security. And while in theory there are sufficient permissions for a user in the http user group to write to the logfile - there's probably some suphp-like behaviour and when your script is accessed through the web it is executed with/as the username that is set as it's owner (file owner of the script that is) - try changing it.
Comments