-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathphp_SAPI_HOWTO
50 lines (33 loc) · 1.99 KB
/
php_SAPI_HOWTO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
This explains how to create the PHP embed SAPI, for several versions.
Download the PHP tarball. The embed SAPI does not appear to be available in
binary format (no .rpm or .deb, etc).
There are a few configurations which are useful.
------------- Deployment -------------
Debug symbols are optional, but optimization should be used.
CC="ccache gcc" CFLAGS="-O3 -g" ./configure --enable-embed $@
This configuration is about 4 times faster than above
------------- Development -------------
To develop, it is worth having debugging symbol and memory leak checker:
CC="ccache gcc" CFLAGS="-O0 -ggdb3" ./configure --enable-debug --enable-maintainer-zts --enable-embed $@
Some notes:
-ggdb3: A lot of the PHP API is macros, and this level of debugging info includes macro data
--enable-debug: Turn on debugging mode
--enable-maintainer-zts: Enable thread safety - means it will break if we get threading info wrong, sometimes at compile time.
--enable-embed: enable the embed SAPI
------------- Benchmarking -------------
In order to do accurate benchmarking, phc must be compiled with -O3. To be fair to PHP, so must the interpreter, and to be fair to phc, it must use an optimized run-time.
CC="ccache gcc" CFLAGS="-O3 -DNDEBUG" ./configure --enable-embed --enable-bcmath --with-gmp --prefix=/usr/local/php-opt $@
Some notes:
--enable-bcmath
--with-gmp: Some of the shootout benchmarks require these.
-DNDEBUG: Turn off assertions.
------------- Server Benchmarking -------------
Some benchmarks require MySQL, and apache modules.
CC="ccache gcc" CFLAGS="-O3 -DNDEBUG" ./configure --enable-embed --enable-bcmath --enable-gmp --prefix=/usr/local/php-server --with-apxs2=/usr/bin/apxs2 --with-mysql $@
Some notes:
--with-apxs2=/usr/bin/apxs2: Apache 2.0 Handler module
--with-mysql: Enable mysql.
Currently there are bugs in apache2 on ubuntu. Add the following to
/etc/apache2/httpd.conf if there are configure problems with --with-apxs2:
#comment
#LoadModule vhost_alias_module /usr/lib/apache2/modules