1<?php 2 3/* This script sets up an event source for use by the php syslog() function. */ 4 5if (!extension_loaded("win32std")) { 6 @dl("php_win32std.dll"); 7} 8 9$PATH = "SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\PHP-" . phpversion(); 10 11$dll = $argv[1]; 12 13if (extension_loaded("win32std")) { 14 $key = @reg_create_key(HKEY_LOCAL_MACHINE, $PATH, KEY_ALL_ACCESS); 15 16 if (!$key) 17 $key = reg_open_key(HKEY_LOCAL_MACHINE, $PATH, KEY_ALL_ACCESS); 18 19 if ($key) { 20 reg_set_value($key, "TypesSupported", REG_DWORD, 7) or die("Types"); 21 reg_set_value($key, "EventMessageFile", REG_SZ, $dll) or die("EventMessageFile"); 22 23 syslog(LOG_NOTICE, "Registered PHP Event source"); 24 } else { 25 echo "Could not register event source\n"; 26 } 27} 28 29/* let's also generate/update the bundled .reg file */ 30 31$dll = addslashes($dll); 32 33file_put_contents("win32/syslog.reg", <<<REG 34REGEDIT4 35 36[HKEY_LOCAL_MACHINE\\$PATH] 37"TypesSupported"=dword:00000007 38"EventMessageFile"="$dll" 39 40REG 41); 42 43 44?> 45