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
    PHP
  • PHP Manager by SuperHosting
    In cPanel you can change the PHP settings for all hosting plans offered by SuperHosting.BG. You can change the PHP version, enable or disable PHP modules and change PHP directives. This... »
  • How to View My PHP Settings (Version, Directives, Modules)?
    For the PHP directives there are system values set by default. You can get information about them by calling the phpinfo() function. By using phpinfo you can view the PHP version, enabled PHP... »
  • PHP Modules (PHP Extensions)
    PHP modules are extensions mostly written in C language. They can be compiled with PHP to enable static loading (as part of the binary file) or dynamic loading (with the... »
  • How to Install and Use a PEAR Package?
    To start using a PEAR Package, first install it into your hosting account and then enable it for the PHP application/script. Installing a PEAR Package Automatic Installation in cPanel PEAR Packages are automatically... »
  • PEAR Packages
    PEAR (PHP Extension and Application Repository) is a framework and distribution system for reusable PHP components. PEAR packages are bundles of files written in PHP that can be embedded into PHP applications. PEAR packages... »
All rights reserved © 2005-2017 , www.superhosting.bg