xref: /PHP-7.4/sapi/phpdbg/web-bootstrap.php (revision b1b39276)
1<?php
2/**
3 * The following file shows how to bootstrap phpdbg so that you can mock specific server environments
4 *
5 * eval include("web-bootstrap.php")
6 * exec index.php
7 * compile
8 * break ...
9 * run
10 */
11if (!defined('PHPDBG_BOOTSTRAPPED'))
12{
13    /* define these once */
14    define("PHPDBG_BOOTPATH", "/opt/php-zts/htdocs");
15    define("PHPDBG_BOOTSTRAP", "index.php");
16    define("PHPDBG_BOOTSTRAPPED", sprintf("/%s", PHPDBG_BOOTSTRAP));
17}
18
19/*
20 * Superglobals are JIT, phpdbg will not over-write whatever you set during bootstrap
21 */
22
23$_SERVER = array
24(
25  'HTTP_HOST' => 'localhost',
26  'HTTP_CONNECTION' => 'keep-alive',
27  'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
28  'HTTP_USER_AGENT' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36',
29  'HTTP_ACCEPT_ENCODING' => 'gzip,deflate,sdch',
30  'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8',
31  'HTTP_COOKIE' => 'tz=Europe%2FLondon; __utma=1.347100075.1384196523.1384196523.1384196523.1; __utmc=1; __utmz=1.1384196523.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)',
32  'PATH' => '/usr/local/bin:/usr/bin:/bin',
33  'SERVER_SIGNATURE' => '<address>Apache/2.4.6 (Ubuntu) Server at localhost Port 80</address>',
34  'SERVER_SOFTWARE' => 'Apache/2.4.6 (Ubuntu)',
35  'SERVER_NAME' => 'localhost',
36  'SERVER_ADDR' => '127.0.0.1',
37  'SERVER_PORT' => '80',
38  'REMOTE_ADDR' => '127.0.0.1',
39  'DOCUMENT_ROOT' => PHPDBG_BOOTPATH,
40  'REQUEST_SCHEME' => 'http',
41  'CONTEXT_PREFIX' => '',
42  'CONTEXT_DOCUMENT_ROOT' => PHPDBG_BOOTPATH,
43  'SERVER_ADMIN' => '[no address given]',
44  'SCRIPT_FILENAME' => sprintf(
45    '%s/%s', PHPDBG_BOOTPATH, PHPDBG_BOOTSTRAP
46  ),
47  'REMOTE_PORT' => '47931',
48  'GATEWAY_INTERFACE' => 'CGI/1.1',
49  'SERVER_PROTOCOL' => 'HTTP/1.1',
50  'REQUEST_METHOD' => 'GET',
51  'QUERY_STRING' => '',
52  'REQUEST_URI' => PHPDBG_BOOTSTRAPPED,
53  'SCRIPT_NAME' => PHPDBG_BOOTSTRAPPED,
54  'PHP_SELF' => PHPDBG_BOOTSTRAPPED,
55  'REQUEST_TIME' => time(),
56);
57
58$_GET = array();
59$_REQUEST = array();
60$_POST = array();
61$_COOKIE = array();
62$_FILES = array();
63
64chdir(PHPDBG_BOOTPATH);
65