zookeeper_03:Java 客户端(原生API)
- 环境配置
- 下载并ZooKeeper的发行版
- 新建Java project,并导入jar包
- 创建会话
public class CreateSession implements Watcher {
private static ZooKeeper zookeeper;
public static void main(String[] args) throws IOException, InterruptedException {
zookeeper = new ZooKeeper("192.168.1.105:2181",5000,new CreateSession());
System.out.println(zookeeper.getState());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(){
System.out.println("do something");
}
public void process(WatchedEvent event) {
System.out.println("收到事件:"+event);
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething();
}
}
}
}
- 同步创建节点
public class CreateNodeSync implements Watcher {
private static ZooKeeper zookeeper;
public static void main(String[] args) throws IOException, InterruptedException {
zookeeper = new ZooKeeper("192.168.124.128:2181,192.168.124.128:2182,192.168.124.128:2183",5000,new CreateNodeSync());
System.out.println(zookeeper.getState());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(){
try {
String path = zookeeper.create("/test", "test".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
System.out.println("return path:"+path);
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("do something");
}
public void process(WatchedEvent event) {
System.out.println("收到事件:"+event);
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething();
}
}
}
}
- 异步创建节点
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooDefs.Perms;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Id;
import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;
public class CreateNodeSyncAuth implements Watcher {
private static ZooKeeper zookeeper;
private static boolean somethingDone = false;
public static void main(String[] args) throws IOException, InterruptedException {
zookeeper = new ZooKeeper("192.168.124.128:2181,192.168.124.128:2182,192.168.124.128:2183",5000,new CreateNodeSyncAuth());
System.out.println(zookeeper.getState());
Thread.sleep(Integer.MAX_VALUE);
}
/*
* 权限模式(scheme): ip, digest
* 授权对象(ID)
* ip权限模式: 具体的ip地址
* digest权限模式: username:Base64(SHA-1(username:password))
* 权限(permission): create(C), DELETE(D),READ(R), WRITE(W), ADMIN(A)
* 注:单个权限,完全权限,复合权限
*
* 权限组合: scheme + ID + permission
*
*
*
* */
private void doSomething(){
try {
ACL aclIp = new ACL(Perms.READ,new Id("ip","192.168.124.128"));
ACL aclDigest = new ACL(Perms.READ|Perms.WRITE,new Id("digest",DigestAuthenticationProvider.generateDigest("zhangsan:123456")));
ArrayList<ACL> acls = new ArrayList<ACL>();
acls.add(aclDigest);
acls.add(aclIp);
//zookeeper.addAuthInfo("digest", "zhangsan:123456".getBytes());
String path = zookeeper.create("/test", "test".getBytes(), acls, CreateMode.PERSISTENT);
System.out.println("return path:"+path);
somethingDone = true;
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void process(WatchedEvent event) {
System.out.println("收到事件:"+event);
if (event.getState()==KeeperState.SyncConnected){
if (!somethingDone && event.getType()==EventType.None && null==event.getPath()){
doSomething();
}
}
}
}
StringCallback{
public void (int rc,String path,Object ctx,String name)
}
rc是result code 服务端响应结果码。客户端可以从这个结果码中识别出API的调用结果,常见的结果码有:
0(OK),接口调用成功
-4(ConnectionLoss),客户端和服务器连接断开
-110(NodeExists) 节点已存在
-112(SessionExpired)会话已过期
path: 接口调用传入的数据节点的节点路径
ctx: 接口调用传入的ctx参数
name: 实际在服务器端创建的节点名
- 同步删除节点
import java.io.IOException;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
public class DeleteNodeSync implements Watcher{
private static ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new DeleteNodeSync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(ZooKeeper zooKeeper){
try {
zooKeeper.delete("/node_7", -1);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (KeeperException e) {
e.printStackTrace();
}
}
@Override
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(zooKeeper);
}
}
}
}
- 异步删除节点
import java.io.IOException;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
public class DeleteNodeASync implements Watcher{
private static ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new DeleteNodeASync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(WatchedEvent event){
zooKeeper.delete("/node_6", -1, new IVoidCallback(),null);
}
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(event);
}
}
}
static class IVoidCallback implements AsyncCallback.VoidCallback{
public void processResult(int rc, String path, Object ctx) {
StringBuilder sb = new StringBuilder();
sb.append("rc="+rc).append("\n");
sb.append("path"+path).append("\n");
sb.append("ctx="+ctx).append("\n");
System.out.println(sb.toString());
}
}
}
- 同步读取节点
import java.io.IOException;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
public class GetDataSync implements Watcher{
private static ZooKeeper zooKeeper;
private static Stat stat = new Stat();
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new GetDataSync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(ZooKeeper zookeeper){
zookeeper.addAuthInfo("digest", "jike:123456".getBytes());
try {
System.out.println(new String(zooKeeper.getData("/node_4", true, stat)));
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(zooKeeper);
}else{
if (event.getType()==EventType.NodeDataChanged){
try {
System.out.println(new String(zooKeeper.getData(event.getPath(), true, stat)));
System.out.println("stat:"+stat);
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
}
- 异步读取节点
import java.io.IOException;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
public class GetDataASync implements Watcher{
private static ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new GetDataASync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(ZooKeeper zookeeper){
zooKeeper.getData("/node_1", true, new IDataCallback(), null);
}
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(zooKeeper);
}else{
if (event.getType()==EventType.NodeDataChanged){
try {
zooKeeper.getData(event.getPath(), true, new IDataCallback(), null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
static class IDataCallback implements AsyncCallback.DataCallback{
public void processResult(int rc, String path, Object ctx, byte[] data,Stat stat) {
try {
System.out.println(new String(zooKeeper.getData(path, true, stat)));
System.out.println("stat:"+stat);
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
- 同步节点检测
import java.io.IOException;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
public class NodeExistsSync implements Watcher{
private static ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new NodeExistsSync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(ZooKeeper zooKeeper){
try{
Stat stat = zooKeeper.exists("/node_1", true);
System.out.println(stat);
}catch(Exception e){
}
}
@Override
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(zooKeeper);
}else{
try {
if (event.getType()==EventType.NodeCreated){
System.out.println(event.getPath()+" created");
System.out.println(zooKeeper.exists(event.getPath(), true));
}
else if (event.getType()==EventType.NodeDataChanged){
System.out.println(event.getPath()+" updated");
System.out.println(zooKeeper.exists(event.getPath(), true));
}
else if (event.getType()==EventType.NodeDeleted){
System.out.println(event.getPath()+" deleted");
System.out.println(zooKeeper.exists(event.getPath(), true));
}
} catch (Exception e) {
}
}
}
}
}
- 异步检测节点
import java.io.IOException;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
public class NodeExistsASync implements Watcher{
private static ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new NodeExistsASync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(ZooKeeper zookeeper){
zooKeeper.exists("/node_1", true, new IStateCallback(), null);
}
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(zooKeeper);
}else{
try {
if (event.getType()==EventType.NodeCreated){
System.out.println(event.getPath()+" created");
zooKeeper.exists(event.getPath(), true, new IStateCallback(), null);
}
else if (event.getType()==EventType.NodeDataChanged){
System.out.println(event.getPath()+" updated");
zooKeeper.exists(event.getPath(), true, new IStateCallback(), null);
}
else if (event.getType()==EventType.NodeDeleted){
System.out.println(event.getPath()+" deleted");
zooKeeper.exists(event.getPath(), true, new IStateCallback(), null);
}
} catch (Exception e) {
}
}
}
}
static class IStateCallback implements AsyncCallback.StatCallback{
public void processResult(int rc, String path, Object ctx, Stat stat) {
System.out.println("rc:"+rc);
}
}
}
- 同步获取子节点
import java.io.IOException;
import java.util.List;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
public class GetChildrenSync implements Watcher{
private static ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new GetChildrenSync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(ZooKeeper zooKeeper){
try {
List<String> children = zooKeeper.getChildren("/", true);
System.out.println(children);
} catch (Exception e) {
}
}
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(zooKeeper);
}else{
if (event.getType()==EventType.NodeChildrenChanged){
try {
System.out.println(zooKeeper.getChildren(event.getPath(), true));
} catch (KeeperException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
}
- 异步获取子节点
import java.io.IOException;
import java.util.List;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
public class GetChildrenASync implements Watcher{
private static ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new GetChildrenASync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(ZooKeeper zookeeper){
try {
zooKeeper.getChildren("/", true, new IChildren2Callback(), null);
} catch (Exception e) {
}
}
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(zooKeeper);
}else{
if (event.getType()==EventType.NodeChildrenChanged){
zooKeeper.getChildren(event.getPath(), true, new IChildren2Callback(), null);
}
}
}
}
static class IChildren2Callback implements AsyncCallback.Children2Callback{
public void processResult(int rc, String path, Object ctx,List<String> children, Stat stat) {
StringBuilder sb = new StringBuilder();
sb.append("rc="+rc).append("\n");
sb.append("path="+path).append("\n");
sb.append("ctx="+ctx).append("\n");
sb.append("children="+children).append("\n");
sb.append("stat="+stat).append("\n");
System.out.println(sb.toString());
}
}
}
- 同步更新
import java.io.IOException;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
public class UpdateNodeSync implements Watcher{
private static ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new UpdateNodeSync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(ZooKeeper zooKeeper){
try {
Stat stat = zooKeeper.setData("/node_6", "123".getBytes(), -1);
System.out.println("stat:"+stat);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (KeeperException e) {
e.printStackTrace();
}
}
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(zooKeeper);
}
}
}
}
- 异步更新
import java.io.IOException;
import org.apache.zookeeper.AsyncCallback;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
public class UpdateNodeASync implements Watcher{
private static ZooKeeper zooKeeper;
public static void main(String[] args) throws IOException, InterruptedException, KeeperException {
zooKeeper = new ZooKeeper("192.168.1.105:2181",5000,new UpdateNodeASync());
System.out.println(zooKeeper.getState().toString());
Thread.sleep(Integer.MAX_VALUE);
}
private void doSomething(WatchedEvent event){
zooKeeper.setData("/node_6", "234".getBytes(), -1, new IStatCallback(),null);
}
public void process(WatchedEvent event) {
if (event.getState()==KeeperState.SyncConnected){
if (event.getType()==EventType.None && null==event.getPath()){
doSomething(event);
}
}
}
static class IStatCallback implements AsyncCallback.StatCallback{
public void processResult(int rc, String path, Object ctx, Stat stat) {
StringBuilder sb = new StringBuilder();
sb.append("rc="+rc).append("\n");
sb.append("path"+path).append("\n");
sb.append("ctx="+ctx).append("\n");
sb.append("Stat="+stat).append("\n");
System.out.println(sb.toString());
}
}
}
zookeeper_03:Java 客户端(原生API)的更多相关文章
- ZooKeeper客户端原生API的使用以及ZkClient第三方API的使用
这两部分内容的介绍主要讲的是节点及节点内容和子节点的操作,并且讲解的节点的事件监听以及ACL授权 ZooKeeper客户端原生API的使用 百度网盘地址: http://pan.baidu.com/s ...
- elasticsearch 口水篇(4)java客户端 - 原生esClient
上一篇(elasticsearch 口水篇(3)java客户端 - Jest)Jest是第三方客户端,基于REST Api进行调用(httpClient),本篇简单介绍下elasticsearch原生 ...
- Java 8原生API也可以开发响应式代码?
前段时间工作上比较忙,这篇文章一直没来得及写,本文是阅读<Java8实战>的时候,了解到Java 8里已经提供了一个异步非阻塞的接口(CompletableFuture),可以实现简单的响 ...
- Kubernetes官方java客户端之七:patch操作
欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...
- zookeeper原生API做java客户端
简介 本文是使用apache提供的原生api做zookeeper客户端 jar包 zookeeper-3.4.5.jar Demo package bjsxt.zookeeper.base; im ...
- JAVA客户端API调用memcached两种方式
1. memcached client for java客户端API:memcached client for java 引入jar包:java-memcached-2.6.2.jar package ...
- hadoop系列二:HDFS文件系统的命令及JAVA客户端API
转载请在页首明显处注明作者与出处 一:说明 此为大数据系列的一些博文,有空的话会陆续更新,包含大数据的一些内容,如hadoop,spark,storm,机器学习等. 当前使用的hadoop版本为2.6 ...
- Java原生API操作XML
使用Java操作XML的开源框架比较多,如著名的Dom4J.JDOM等,但个人认为不管你用那个框架都要对JDK原生的API有所了解才能更得心应手的应用.本篇就来简单了解下原生的XML API. JAV ...
- Zookeeper Java客户端API的使用
1. 原生api 具体查看下面github代码 2. ZkClient ZkClient是Github上一个开源的ZooKeeper客户端.ZkClient在ZooKeeper原生 A ...
- Zookeeper系列三:Zookeeper客户端的使用(Zookeeper原生API如何进行调用、ZKClient、Curator)和Zookeeper会话
一.Zookeeper原生API如何进行调用 准备工作: 首先在新建一个maven项目ZK-Demo,然后在pom.xml里面引入zk的依赖 <dependency> <groupI ...
随机推荐
- 五、MP3文件认识上的几个误区
1.每帧播放时长都为26ms? 很多博客和文章都提到,Mp3文件每个帧的播放时长(Frame_PlayingTime)是26ms,这个结论是错误的.公式应该是这样的: 一个帧的播放时长=一个帧的采样个 ...
- NET基础课--XML基础
id level是属性,title为子节点 接下来操作子节点 比较xml的处理方式: 1和3适合数据量小的时候.
- 监控代码运行时长 -- StopWatch用法例程
在.net环境下,精确的测量出某段代码运行的时长,在网络通信.串口通信以及异步操作中很有意义.现在做了简单的总结.具体代码如下: (1).首先 using System.Diagnostics; (2 ...
- .NET防止SQL、JS、HTML注入
/// <summary> /// 过滤标记 /// </summary> /// <param name="NoHTML">包括HTML,脚本 ...
- HtmlHelp
@Html.Label("Label", "Label") @*渲染成<label for="Label">Label</ ...
- C#常用的内置委托
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- iOS中通知的添加和移除
我们都知道viewWillAppear:方法是在控制器的view将要显示的时候调用的,而viewWillDisappear:方法是在控制器的view将要隐藏的时候调用.很多时候我们根据自身需要将相关代 ...
- GDAL 生成shp文件
附件:http://pan.baidu.com/s/1i3GPwrV(C#版GDAL接口.dll) 示例程序: http://pan.baidu.com/s/1jpIKQ (程序是在vs2008 x ...
- Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to “*****”
Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment ...
- php.ini 全站,和htaccess web目录 默认头部和尾部 auto_prepend_file
php.ini ; Automatically add files before PHP document. ; http://php.net/auto-prepend-file auto_prepe ...