PageRenderTime 26ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/docs/php.txt

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