我爱帮助网--QQ交流群号

Nas交流与矿渣群(unraid 群晖 猫盘 蜗牛等):372167400         物联网/智能家居群:518812757             帮助教程:手册大全

软件使用与建站群:1057308983      虚拟化交流群:13448651

PHP.ini设置错误日志转到syslog,但windows系统 事件查看器找不到PHP的错误日志

2017-05-17 22:53:00
zstmtony
转贴
3361

PHP.ini设置错误日志转到syslog,但windows系统 事件查看器找不到PHP的错误日志

已经设置了以下:

- IIS 7 或 IIS8.5
- Windows Server 2008 或 Windows Server 2012 R2
- PHP 5.3.0 或 PHP5.6.9
- Role Service: Cgi
- php.ini:
error_reporting = E_ALL & ~E_DEPRECATED
log_errors = On
error_log = syslog
以上设置都无法真正解决。看来原因不在这些地方


真正解决办法:

有效,但有占复杂

I found some more hints:

1. If you have severe errors in your php.ini, it gets logged in the event log, e.g.  
PHP Warning:  PHP Startup: Unable to load dynamic library '[..]\ext\php_mbstring.dll' - The specified procedure could not be found.
 2. I found some helpings on IIS6 and PHP5 with fastcgi add-on:

Copy the PHP 5 binaries to "C:\php".
Right-click My Computer and select Properties to bring up the Computer Properties dialog. Switch to the Advanced tab and click Environment Variables. Find the system environment variable PATH, edit it and add ";C:\php" (without the quotes) to the end.
Make sure that the configuration file "php.ini" resides in the directory "C:\php" and contains the correct path settings.
DELETE any old "php.ini" files from "C:\WINDOWS" and other directories.
Open REGEDIT, navigate to the key "HKEY_LOCAL_MACHINE\SOFTWARE\PHP" and DELETE the string value "IniFilePath" from there. It is outdated and no longer necessary!
Modify NTFS security permissions of the directory "C:\php" to give Read and Execute permissions to (1) the IIS Guest Account and (2) the group IIS_WPG.
Modify NTFS security permissions of the directories "C:\php\session" and "C:\php\upload" to give additional Modify permissions to (1) the IIS Guest Account and (2) the group IIS_WPG.
Navigate to the registry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application" and edit the value "CustomSD" there. Find the substring "(D;;0xf0007;;;BG)" which Denies access to the application event log for Builtin Guest accounts (like the IIS Web User account) and replace this substring with "(A;;0x3;;;BG)" which allows read and write access. Please pay attention to leave the rest of the security string intact. Damaging this value can have dangerous effects!
Create or update the registry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PHP-5.2.0" (adapt the last to your version part if necessary) with the following values:
"EventMessageFile" (REG_EXPAND_SZ) = "C:\php\php5ts.dll"
"TypesSupported" (REG_DWORD) = 7
That didn't work out as well. I assume this isn't support by W2K8 any longer?! Any help?


Cheers

PHP IIS7 IIS6 IIS 6.0 FASCGI IIS 7 SYSLOG IIS 6

Replymspoerleintu
mspoerleintu
2 Posts
Re: FastCGI does not pass PHP error to syslog (windows event log)
Aug 14, 2009 01:34 PM|LINK

 Solved:

grant write access on (application) event log (http://www.ravenreport.com/blog/post/Remote-Event-Viewer-Access-Windows-2003--2008.aspx)

Here is our scenario: 
get windows Security IDentifier (SID) for all 3 accounts (!)
IUSR (S-1-5-17)
iis_iusrs (S-1-5-32-568)
network services (S-1-5-20) [application pool user]
http://support.microsoft.com/kb/243330 (well known SIDs)
http://msdn.microsoft.com/en-us/library/cc980032(PROT.10).aspx
http://en.wikipedia.org/wiki/Security_Identifier
extract current permissions on command line using: wevtutil gl application >temp.txt
edit line "channelAccess", e.g: channelAccess: O:BAG:[...]
Remove any brackets staring with (D;; and containing any of your SIDs
add each of your SIDs in brackets (A;;0x3;;;<SID>) (0x1 = read; 0x2 = write; 0x4=delete) to channelAccess line
in our case: (A;;0x3;;;S-1-5-17)(A;;0x3;;;S-1-5-32-568)(A;;0x3;;;S-1-5-20)
grant permission by pasting your edited channelAccesson command line: wevtutil sl application /ca:O:BAG:[...]
You may imagine the odysee i've been through :)
Let me know if it is working, our which settings you had to modify..

Cheers

创建的 注册表项 要另存为 Unicode 的reg扩展名。双击执行后,看看注册表对不对,不对再手工进入注册表修改一下

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\PHP-5.6.9]
"EventMessageFile"="D:\WebCore\phpweb\php56\php5.dll"
"TypesSupported"=dword:00000007


我导出的temp 文件内容为如下:

name: application
enabled: true
type: Admin
owningPublisher: 
isolation: Application
channelAccess: O:BAG:SYD:(A;;0x2;;;S-1-15-2-1)(A;;0xf0007;;;SY)(A;;0x7;;;BA)(A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)(A;;0x3;;;S-1-5-33)(A;;0x1;;;S-1-5-32-573)
logging:
  logFileName: %SystemRoot%\System32\Winevt\Logs\application.evtx
  retention: false
  autoBackup: false
  maxSize: 20971520
publishing:
  fileMax: 1


原技巧对应网站:https://forums.iis.net/t/1159662.aspx?FastCGI+does+not+pass+PHP+error+to+syslog+windows+event+log+


或像这篇文章:http://php.net/manual/zh/function.error-log.php

Navigate to the registry key 
"HKLM\SYSTEM\CurrentControlSet\Services\Eventlog
\Application" and edit the value "CustomSD" there. Find 
the substring "(D;;0xf0007;;;BG)" which Denies access to 
the application event log for Builtin Guest accounts (like 
the IIS Web User account) and replace this substring with 
"(A;;0x3;;;BG)" which allows read and write access. Please 
pay attention to leave the rest of the security string intact. 
Damaging this value can have dangerous effects!
   9. Create or update the registry key 
"HKLM\SYSTEM\CurrentControlSet\Services\Eventlog\Application\
PHP-5.2.0" (adapt the last to your version part 
if necessary) with the following values:

          * "EventMessageFile" (REG_EXPAND_SZ) = "C:\php\php5ts.dll"

          * "TypesSupported" (REG_DWORD) = 7



0
发表评论
评论通过审核后显示。
文章分类
联系我们
联系人: 王先生