PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

Plain Text | 46 lines | 36 code | 10 blank | 0 comment | 0 complexity | 8684ce0b2593b0a2135d3b6f73853e12 MD5 | raw file
 1PHP Support
 4PHP support in Silver Lining is experimental.  Meaning, I'm not sure
 5exactly *how* it should work, or if it is working well.  It also adds
 6a slightly Pythonesque flare to the request dispatching.
 8Enabling PHP
11To enable PHP, in your ``app.ini`` file, place::
13    platform = php
14    php_root = site/
15    runner = site/runner.php
17``platform = php`` indicates that this is a PHP app.  PHP will be
18installed on the server if necessary.  No PHP libraries will be
19installed!  However if you use, for example, ``service.postgis``, then
20the PostgreSQL drivers for PHP will be installed.
22Requests that point to a file in ``static/`` will (like with Python)
23serve that file directly.  Files that point to something in
24``php_root`` (in this example ``site/``) will also be served directly,
25so long as they are not ``.php`` files (as it is the norm to mix code
26with static files in PHP applications).
28*All* PHP requests will go through the runner (``site/runner.php`` in
29our example).  This PHP file may direct the request wherever it sees
30fit.  If you wish to simply pass it on, you may do so, like::
32    $path = silver_call_next("{$silver_base}/DEFAULT.php");
33    include $path;
35Note if the file isn't found then ``DEFAULT.php`` would have been
38Note that ``.htaccess`` files will not work, so if you need that kind
39of functionality you'll need to implement it directly in your runner.
40This is somewhat easier than it might otherwise be with a PHP
41application, because you can be sure that *all* (dynamic) requests
42will go through your runner.  But it means if your application has a
43sophisticated set of rewrite rules, for example, you'll have to
44replicate them in PHP.  This is probably fairly mechanical (you can
45turn those rules into PHP regexes), but documentation on how to do
46that translation would be extremely helpful.