xref: /PHP-7.2/sapi/apache2handler/README (revision 60a69dae)
1WHAT IS THIS?
2
3    This module exploits the layered I/O support in Apache 2.0.
4
5HOW DOES IT WORK?
6
7    In Apache 2.0, you have handlers which generate content (like
8    reading a script from disk). The content goes then through
9    a chain of filters. PHP can be such a filter, so that it processes
10    your script and hands the output to the next filter (which will
11    usually cause a write to the network).
12
13DOES IT WORK?
14
15    Currently the issues with the module are:
16        * Thread safety of external PHP modules
17        * The lack of re-entrancy of PHP. due to this I have disabled the 'virtual'
18          function, and tried to stop any method where a php script can run another php
19          script while it is being run.
20
21
22HOW TO INSTALL
23
24    This SAPI module is known to work with Apache 2.0.44.
25
26        $ cd apache-2.x
27        $ cd src
28        $ ./configure --enable-so
29        $ make install
30
31    For testing purposes, you might want to use --with-mpm=prefork.
32    (Albeit PHP also works with threaded MPMs. See Thread Safety note above)
33
34    Configure PHP 4:
35
36        $ cd php-4.x
37        $ ./configure --with-apxs2=/path/to/apache-2.0/bin/apxs
38        $ make install
39
40    At the end of conf/httpd.conf, add:
41
42        AddType application/x-httpd-php .php
43
44    If you would like to enable source code highlighting functionality add:
45
46        AddType application/x-httpd-php-source .phps
47
48    That's it. Now start bin/httpd.
49
50HOW TO CONFIGURE
51
52    The Apache 2.0 PHP module supports a new configuration directive that
53    allows an admin to override the php.ini search path. For example,
54    place your php.ini file in Apache's ServerRoot/conf directory and
55    add this to your httpd.conf file:
56
57        PHPINIDir "conf"
58
59DEBUGGING APACHE AND PHP
60
61    To debug Apache, we recommend:
62
63        1. Use the Prefork MPM (Apache 1.3-like process model) by
64           configuring Apache with '--with-mpm=prefork'.
65        2. Start httpd using -DONE_PROCESS (e.g. (gdb) r -DONE_PROCESS).
66
67    If you want to debug a part of the PHP startup procedure, set a
68    breakpoint on 'load_module'. Step through it until apr_dso_load() is
69    done. Then you can set a breakpoint on any PHP-related symbol.
70
71TODO
72
73    PHP functions like apache_sub_req (see php_functions.c)
74    Source Code Highlighting
75    Protocol handlers
76