php

Switches the PHP version. It will also restart the service.

In case of Security Edition, it switches the web server you are using to "nginx reverse proxy + production php + staging php" running the Web server and the application on different NGINX. It will also restart the service.
For details on the differences between Web servers, please refer to the KUSANAGI Security Edition Web Server Configurations.
For details on production nginx and staging nginx, please refer to proxy command.

In case of Security Edition, you can specify different versions of PHP for the the production php, and the staging php.
If no critical errors are detected on the staging php during the staging period, the version of PHP of the production php will be automatically upgraded to the version of PHP of the staging php.
Additionally, if a critical error is detected on the staging php during the staging period, the staging php will be automatically stopped and switched back to the production php with the original versions of PHP.

Example

kusanagi php --use php83
kusanagi php
In case of Security Edition:
kusanagi php --use php83 --staging php85
In case of Security Edition:
kusanagi php --nostaging

Options

(No options)

Optimizes PHP settings.
Execute this subcommand if you change the instance settings after setting up KUSANAGI.
If "php-fpm" is already running, it will restart "php-fpm".

PHP Version

[--use {installed | php85 | php84 | php83 | php82 | php74}]	
Discontinued options
--use php81 (discontinued as of 9.8.5 and 10.3.5)
--use php80 (discontinued as of 9.6.8 and Security Editon)
--use php74 (discontinued as of Security Editon)
--use php73 (discontinued as of 9.1.13)

Default: installed

Specifies the PHP version to be used. When one of the following PHP is specified, it will start up.
"--use", "--reload", "--test", "--status" and "--showpath" cannot be specified at the same time.

  • --use installed: currently installed php
  • --use php85: PHP 8.5
  • --use php84: PHP 8.4
  • --use php83: PHP 8.3
  • --use php82: PHP 8.2
  • --use php81 (discontinued as of 9.8.5 and 10.3.5): PHP 8.1
  • --use php80 (discontinued as of 9.6.8 and Security Editon): PHP 8.0
  • --use php74 (discontinued as of Security Editon): PHP 7.4
  • --use php73 (discontinued as of 9.1.13): PHP 7.3

PHP Version for Staging (In case of Security Edition)

[--staging {php85 | php84 | php83 | php82 | latest} | --nostaging | --no-staging]

Default: none (do not change PHP version of the staging php)

Specifies the version of PHP to be used for staging. When one of the following PHP is specified, it will start up.
If "--nostaging" or "--no-staging" are specified, the staging nginx will be stopped.
If none of "--staging", "--nostaging" or "--no-staging" is specified, it will not change the staging php. If the staging php is already running, the version of PHP will be same as it is. If the staging php is already stoppped, the staging php will still be stopped.
"--staging", "--nostaging" and "--no-staging" cannot be specified with "--reload", "--test" or "--status" at the same time.
"--staging", "--nostaging" and "--no-staging" cannot be specified at the same time.

Staging Period (In case of Security Edition)

[--staging-days DAYS]

Default: 7 days

Specifies the staging period in days.
This option only takes effect when specified together with “--staging”.

Reloading Configuration

[--reload]

Reloads configuration without disconnecting the session.
"--use", "--reload", "--test", "--status" and "--showpath" cannot be specified at the same time.

Checking Configuration File

[--test]

Checks the configuration files only.
"--use", "--reload", "--test", "--status" and "--showpath" cannot be specified at the same time.

Displaying Status

[--status]

Displays status of php-fpm.
"--use", "--reload", "--test", "--status" and "--showpath" cannot be specified at the same time.

Displaying Full Path of php Command

[--showpath]

Displays the full path of php command.
"--use", "--reload", "--test", "--status" and "--showpath" cannot be specified at the same time.

Output

# kusanagi php
php completed.