[跨服务器查询sql]跨服务器保存iis日志方法

更新时间:2016-11-01    来源:php函数    手机版     字体:

【www.bbyears.com--php函数】

php教程可扩展特性实现可以远程保存游戏用户日志信息,这里我暂时叫他tlog(与文件服务器建立tcp/ip连接,当然最好是udp),目前定义了三个函数
tlog_init,tlog_record,tlog_close
tlog_init(ip,port)用来连接文件服务器其中ip,port分别为文件服务器地址和端口
tlog_record(message,file)用户发送要记录的日志内容和日志保存的文件
tlog_close为关闭发送日志产生的socket链接

$result = tlog_init("127.0.0.1", 9734);
if ($result) {
    tlog_record("hello" . time(), "1.log");
    tlog_record("hello world" . time(), "2.log");
    tlog_close();
}
?>

我们主要修改config.m4,tlog.c,php_tlog.h实现我们要的功能
   打开config.m4,
  删除 php_arg_enable(tlog, whether to enable tlog support, 行开始注释dnl
  删除[  --enable-tlog           enable tlog support]) 行开始注释dnl
  打开php_tlog.h 增加


php_function(tlog_init);
php_function(tlog_record);
php_function(tlog_close);

外t_log.c见包
  以上步骤后进入tlog目录执行
   ./你的php安装目录/bin/phpize 我的目录为/usr/local/webserver/php5.3.3,则该命令./usr/local/webserver/php5.3.3/bin/phpize
./configure --with-php-config=/usr/local/webserver/php5.3.3/bin/php-config
make
sudo make install  (因为我使用的ubuntu,所以带了sudo主要是php安装目录创建扩展时的权限问题)

修改php.ini增加tlog.so扩展

查看phpinfo();

本文来源:http://www.bbyears.com/jiaocheng/27958.html

猜你感兴趣