https://help.superhosting.bg/en/php-cli.html
  • bg
  • en

Hosting, Domains, Cloud, Virtual Private Servers (VPS), Managed VPS, SSL Certificates

PHP CLI (Command Line Interface)

PHP
php, php cli, php shell, php command line, php console, php-cli, php sapi, php sapi cli

PHP supports different Server Application Programming Interfaces (SAPI) for environment interaction and connection to non-native technologies. Two of them are PHP CLI and PHP CGI (FastCGI).

As of v. 4.3.0, PHP supports an additional interface called CLI (Command Line Interface) intended to be used in a shell environment.

PHP CLI is used for developing applications in PHP that can be automated with Cron jobs, for administration, testing and other tasks, suitable for shell usage. PHP CLI runs directly in server environment without requesting connection to the web server from the CGI (FastCGI) interface.

info-iconShared hosting and Managed VPS servers by SuperHosting.BG support both interfaces - PHP CGI (FastCGI) and PHP CLI.

PHP CLI differs from other interfaces mainly because of the following reasons:

  • It does not return HTTP headers; it starts with a -q (quiet-mode) option by default, which suppresses HTTP header output (stdout);
  • It does not change its current directory to the directory of the executed script;
  • It uses only plain text error messages. The php.ini directive is set in the following way: html_errors: FALSE. This is due to the fact that reading error messages with HTML tags is quite complicated while working in a shell environment. Hence, HTML formatting has been disabled;
  • Some php.ini directives are overridden for PHP CLI because they do not make sense in shell environments.
    • max_execution_time: 0 (unlimited) does not hold restrictions for script execution time;
    • max_input_time: FALSE - PHP CLI does not support GET, POST or uploading files;

PHP is configured and installed on the server with two separate executable / binary files for CLI and CGI (FastCGI).

For the default PHP version: For additional PHP versions:
PHP CGI (FastCGI) /usr/bin/php /usr/local/phpX.X/bin/php-cgi
PHP CLI /usr/local/bin/php /usr/local/phpX.X/bin/php
phpX.X - replace with the PHP version,
for example /usr/local/php5.6/bin/php

info-iconNote: You can view all the available PHP versions in cPanel.

This article is about: hosting services with cPanel

500px270px
SuperHosting.BG

Comments

Be the First to Comment!

Notify of
avatar
wpDiscuz
All rights reserved © 2005-2017 , www.superhosting.bg