README-main 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. $OpenBSD: README-main,v 1.2 2016/04/28 18:19:23 sthen Exp $
  2. +-----------------------------------------------------------------------
  3. | Running ${FULLPKGNAME} on OpenBSD
  4. +-----------------------------------------------------------------------
  5. Connecting your web server software to php
  6. ==========================================
  7. Web server programs such as httpd(8), nginx and Apache listen for
  8. network requests and decide whether to respond themselves (as is the
  9. case with simple "static" files) or pass the request on to other
  10. software for handling. The web server must be configured to handle
  11. this - different methods are used depending on the server software.
  12. httpd(8), nginx, lighttpd, etc: FastCGI
  13. ---------------------------------------
  14. Most modern web servers support FastCGI which is a simple method of
  15. interfacing to many kinds of application server. This is usually the
  16. preferred method of passing requests to php, and is the only method
  17. possible for many servers such as httpd(8), nginx and lighttpd.
  18. The OpenBSD php packages include php-fpm, FastCGI Process Manager.
  19. This manages pools of FastCGI processes: starts/restarts them and
  20. maintains a minimum and maximum number of spare processes as
  21. configured. You can use rcctl(8) to enable php-fpm at boot,
  22. and start it at runtime:
  23. rcctl enable php${SV}_fpm
  24. rcctl start php${SV}_fpm
  25. Consult your web server documentation and sample configuration
  26. for further advice. In particular:
  27. httpd(8) /etc/examples/httpd.conf
  28. nginx ${LOCALBASE}/share/nginx/nginx.conf
  29. php-fpm has its own configuration file, ${SYSCONFDIR}/php-fpm.conf.
  30. This controls how the php processes are started. The default settings
  31. are suitable for many standard cases, but can be changed to provide
  32. greater control for sites handling high loads or to provide
  33. separation between different php applications by running them
  34. under different uids or in individual chroot(2) jails.
  35. Apache module
  36. -------------
  37. The most common option for use with Apache is the mod_php Apache module.
  38. This is loaded directly as part of the web server process. Configuration
  39. is fairly simple, but in this case the operating system can't provide
  40. memory protection between the two; therefore bugs in php can potentially
  41. do more damage this way.
  42. Another option is to use FastCGI as described in the previous section;
  43. you can use mod_proxy_fcgi to interface it with Apache.
  44. If you wish to use the Apache module, enable it by creating a
  45. symbolic link from ${MODPHP_CONFIG_PATH}/modules.sample/php-${PV}.conf
  46. to ${MODPHP_CONFIG_PATH}/modules/php.conf. As root:
  47. ln -sf ${MODPHP_CONFIG_PATH}/modules.sample/php-${PV}.conf \
  48. ${MODPHP_CONFIG_PATH}/modules/php.conf
  49. To disable:
  50. rm -f ${MODPHP_CONFIG_PATH}/modules/php.conf
  51. After making either of these changes, restart Apache.
  52. php configuration
  53. =================
  54. The recommended php configuration has been installed to:
  55. ${SYSCONFDIR}/php-${PV}.ini.
  56. Modify this as required for your use.
  57. Extension modules
  58. =================
  59. Many language features in php are provided by extensions, which come
  60. in several classes.
  61. - some extensions are included in the main PHP package and are always
  62. enabled; they don't need to be installed or enabled separately. This
  63. includes the Suhosin security extension; see https://suhosin.org/
  64. for more information.
  65. - for PHP 5.6+, opcache is in the main package but must be configured.
  66. - some 'core' extensions with extra dependencies are packaged separately
  67. (e.g. php-pdo_mysql, php-ldap, php-soap, and others) and can be installed
  68. with pkg_add(1).
  69. - various useful third-party extensions from the PECL repository have
  70. also been packaged. Examples include pecl-memcache (for use with
  71. sysutils/memcached), pecl-imagick (image manipulation using ImageMagick),
  72. pecl-libsodium (a wrapper for the libsodium cryptographic library), etc.
  73. For all extensions packaged separately (and for opcache), you will find a
  74. file named ${SYSCONFDIR}/php-${PV}.sample/(MODULE_NAME).ini. To enable it,
  75. add a symlink into ${SYSCONFDIR}/php-${PV} and restart:
  76. ln -sf ../php-${PV}.sample/MODULE_NAME.ini ${SYSCONFDIR}/php-${PV}/
  77. To disable, remove the symlink from ${SYSCONFDIR}/php-${PV} and restart:
  78. rm ${SYSCONFDIR}/php-${PV}/MODULE_NAME.ini
  79. If you have installed a number of extensions and wish to enable them all,
  80. you can use these shell commands:
  81. # cd ${SYSCONFDIR}/php-${PV}.sample
  82. # for i in *; do ln -sf ../php-${PV}.sample/$i ../php-${PV}/; done
  83. After enabling or disabling extensions (or otherwise modifying php's
  84. configuration), use rcctl(8) to restart php${SV}_fpm or Apache.