PHP modes

From ISPWiki
Revision as of 11:02, 25 January 2017 by Ksenya (talk | contribs) (If Nginx+Apache are used as a web-server)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

All php settings are taken from the php.ini files. For more information please read the article How the "PHP settings" module works when modifying parameters

Apache web-server

Apache module

Scripts are processed by Apache, that's why it should be configured with mod_php. In the VirtualHost section of the Apache configuration file the following directories are specified:

  php_admin_value sendmail_path
  php_admin_value upload_tmp_dir
  php_admin_value session.save_path
  php_admin_value open_basedir

Note: the settings specified in the global php.ini will be applied, therefore only an administrator can select required settings in the PHP settings module.


The following parameters are specified in VirtualHost

  ScriptAlias /php-bin/ /user_homedir/data/php-bin/
  AddHandler application/x-httpd-php5 .php .php3 .php4 .php5 .phtml
  Action application/x-httpd-php5 /php-bin/php

Custom php.ini is used (it is located in ~data/php-bin/php.ini). A user can provide required settings in the PHP settings module. The settings that were not changed by the user, will be set to default PHP values.


Be sure to run Apache Prefork instead of Apache ITK to be able to activate this mode. All other settings are specified in the same way as for "PHP as CGI".


The same modes as for Apache will be available. Nginx will send statistical information, and Apache will process scripts.

Besides, one more mode will be available:

FastCGI (Nginx+PHP-FPM)

Scripts are processed by PHP-FPM, rather than by Apache. If your sites are running in this mode, Apache won't start and won't be configured at all. Additional location is specified into the server section of the Nginx configuration file:

  location @php {
          fastcgi_index index.php;
          fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f e-mail_администратора";
          fastcgi_pass unix:/var/www/php-fpm/username.sock;
          fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
          try_files $uri =404;
          include fastcgi_params;

PHP settings are taken from custom php.ini like in the CGI mode.