Skip to content
Newer
Older
100644 149 lines (91 sloc) 4.85 KB
cf33fe5 Initial Release
pollita authored
1 Runkit extension for PHP
2 ========================
3
ce9c7a8 @zenovich Update README
authored
4 For all those things you.... probably shouldn't have been doing anyway.... but surely do!
cf33fe5 Initial Release
pollita authored
5
c5f3202 @zenovich donations info
authored
6 ---------------------
7 Feel free to support Dmitry Zenovich via PayPal (dzenovich@gmail.com) if Runkit serves you.
8 By making donation you invest in the project's future, helping it to be compatible with current PHP versions
9 and to have less bugs and more features.
10 ---------------------
11
cf33fe5 Initial Release
pollita authored
12 Runkit has three groups of features outlined below:
13
14
15 [CUSTOM SUPERGLOBALS]
ee43586 @zenovich added instructions on building runkit module for windows
authored
16 A new .ini entry `runkit.superglobal` is defined which may be specified as a simple variable, or list of simple variables to be registered as
cf33fe5 Initial Release
pollita authored
17 superglobals. runkit.superglobal is defined as PHP_INI_SYSTEM and must be set in the system-wide php.ini.
18
19 Example:
20
21 php.ini:
22 runkit.superglobal=foo,bar
23
24 test.php:
25 function testme() {
26 echo "Foo is $foo\n";
27 echo "Bar is $bar\n";
28 echo "Baz is $baz\n";
29 }
30 $foo = 1;
31 $bar = 2;
32 $baz = 3;
33
34 testme();
35
36 Outputs:
37 Foo is 1
38 Bar is 2
39 Baz is
40
41
acdbb2f @zenovich stop supporting php4
authored
42 Compatability: PHP 5.0 or greater
cf33fe5 Initial Release
pollita authored
43
44
45 [USER DEFINED FUNCTION AND CLASS MANIPULATION]
46 Userdefined functions and userdefined methods may now be renamed, delete, and redefined using the API described at http://www.php.net/runkit
47
48 Examples for these functions may also be found in the tests folder.
49
acdbb2f @zenovich stop supporting php4
authored
50 Compatability: PHP5
cf33fe5 Initial Release
pollita authored
51
52
53 [SANDBOXING]
ee43586 @zenovich added instructions on building runkit module for windows
authored
54 With the introduction of TSRM based subinterpreter support a running PHP script may now generate a new thread and interactively switch contexts back and
55 forth between it. THIS FEATURE DOES NOT PROVIDE FULL SCRIPT THREADING. This feature only allows you to run processes in a subinterpreter optionally
cf33fe5 Initial Release
pollita authored
56 with additional security.
57
58 First, create an instance of the Runkit_Sandbox object:
59
60 $php = new Runkit_Sandbox();
61
62 To read and write variables in this subinterpreter, just access the properties of the object:
63
64 $php->foo = 'bar';
65 $php->baz = 'boom';
66
67 Individual functions may also be called (executed within the newly created scope):
68
69 $php->session_start();
70
71 Or you can execute a block of arbitrary code:
72
73 $php->eval('echo "The value of foo is $foo\n";');
74
75 In this example, $foo will be interpolated as 'bar' since that's what you set it to earlier.
76
ee43586 @zenovich added instructions on building runkit module for windows
authored
77 Certain INI Options which are ordinarily only modifiable in the system php.ini may be passed during instantiation and changed for your subinterpreter as
cf33fe5 Initial Release
pollita authored
78 well, these options are passed as an associative array to the Runkit_Sandbox constructor and include the following:
79
ee43586 @zenovich added instructions on building runkit module for windows
authored
80 safe_mode safe_mode may only be turned on for a Runkit_Sandbox interpreter using this option. It cannot be turned off, doing so would
cf33fe5 Initial Release
pollita authored
81 circumvent the setting specified by your system administrator in the system php.ini.
82
83 open_basedir Like safe_mode, you can only use this setting to make things more restrictive.
84
cd91d0d @zenovich README: allow_url_include, installing via pecl
authored
85 allow_url_fopen In keeping with safe_mode, these can only be turned off (more restrictive than global environment)
86 allow_url_include
cf33fe5 Initial Release
pollita authored
87
88 disable_functions Any function names specified in this coma-delimited list will be disabled IN ADDITION TO already disabled functions.
89
90 disable_classes Like disable_functions, this list is in addition to already disabled classes.
91
ee43586 @zenovich added instructions on building runkit module for windows
authored
92 Sandboxing is ONLY AVAILABLE in PHP 5.1 (release version, or snapshot dated after April 28th, 2005) when thread safety has been enabled. To enable
93 thread safety, just make sure that --enable-maintainer-zts is specified on your ./configure line. This doesn't necessarily mean that your SAPI will use
94 PHP in a threaded manner, just that PHP is prepared to behave that way. If you're building for Apache2-Worker then you're already built for thread
cf33fe5 Initial Release
pollita authored
95 safety.
96
97 If you wish/need to use PHP 5.0.x, or a cvs snapshot of 5.1 which predates April 28th, you can apply the tsrm_5.0.diff patch included in this package:
98
99 cd /path/to/php-5.0.x/
100 cat /path/to/runkit/tsrm_5.0.diff | patch -p0
101
102 Then just rebuild using the --enable-maintainer-zts option specified above.
103
104
105 runkit_lint() and runkit_lint_file() also exist as a simpler approach to verifying the syntactic legality of passed code within an isolated environment.
ee43586 @zenovich added instructions on building runkit module for windows
authored
106
107
cd91d0d @zenovich README: allow_url_include, installing via pecl
authored
108 [BUILDING AND INSTALLING LATEST RELEASE WITH PECL IN UNIX]
109
ce9c7a8 @zenovich Update README
authored
110 pecl install runkit
cd91d0d @zenovich README: allow_url_include, installing via pecl
authored
111
112
113 [BUILDING AND INSTALLING CURRENT DEVELOPMENT VERSION IN UNIX]
c337393 @zenovich Update README
authored
114
115 git clone https://github.com/zenovich/runkit.git
116 cd runkit
117 phpize
118 ./configure
119 make
120 make test
121 sudo make install
122
123
ee43586 @zenovich added instructions on building runkit module for windows
authored
124 [BUILDING THE RUNKIT MODULE FOR WINDOWS]
125 First, place source code of runkit into a temporary directory, for example "C:\runkit-source".
126 Open your Windows SDK command prompt or Visual Studio Command prompt.
127 Then change into the runkit's source code directory:
128
129 C:
130 cd C:\runkit-source
131
132 After that, run phpize from your PHP SDK. This may be something like
133
134 C:\php\SDK\phpize.bat
135
136 Then configure your runkit module by executing "configure". You can view the full list of options by the command
137
138 configure --help
139
140 but in most cases, you probably will choose a simple command
141
142 configure --enable-runkit
143
144 After all run
145
146 nmake
147
148 Now you should have the "php_runkit.dll" file.
Something went wrong with that request. Please try again.