This page has been translated from Spanish

...::: Guatewireless.org ::::..

Technology, Software Libre, Guatemala, Open Source, Linux, Wireless, WiFi, Scripting, Debian, CentOS, Gentoo, Redhat, SuSE, Windows

Installing PHP for command line

 ¿Qui © is PHP CLI?

PHP CLI is a PHP interface for short command line. As its name implies, this is a way to use PHP on the command line system. In other words, is a way to run PHP scripts that are not on a web server (like Apache or IIS Web server from Microsoft).

The people speak and think in PHP web development, see PHP as a server-side tool. However, PHP CLI applies all the benefits of PHP scripts which allow shell scripts to create server-side services or applications to GUI system.

PHP CLI is available for all operating systems: Linux, Windows, OSX, Solaris.

 © Why use PHP CLI chemical?

You want to use PHP CLI SAPI Just because there are several advantages in being able to execute PHP code from the command line like:

  • No need to learn another language development, such as Perl, Bash or Awk
  • Schedule and run tasks from cron written in php
  • Making GUI applications with PHP and GTK
  • Reuse existing components
  • Write robust scripts or scripts for your system using the multithread capability PHP5
  • Access to STDIN, STDOUT, STERRAD operating system with PHP

The popular Linux distributions (like Ubuntu, Debian, Fedora, Suse, etc) allow you to install PHP CLI from the package manager (eg Synaptic or similar) with a few mouse clicks. This makes trouble-free installation and you can start using in a second!

If you have a standard installation of PHP for the Apache Web server, then there is high probability that you already have PHP CLI installed. The possibilities are even greater if your system is running Linux.

Otherwise, some scrip to want to run PHP from the command line, Linux will show this error:

  fher98 @ deathbian: ~ $ php
 / usr / bin / env: php: No such file or directory 

Even in facilities 5.2.x the only Php Php files in /usr/bin are /usr/bin/php-cgi y /usr/bin/php5-cgi For I may not run their PHP from the console. To resolve this can create a symbolic link in / usr / bin / from php to php5-cgi. After running the command which php show them where is the php command.

Installing PHP CLI on Debian / Ubuntu

If you followed the installation guide for Apache / PHP and now want to run PHP pages from the command line is necessary to make the installation of the PHP CLI.

  deathbian: ~ # apt-get install php4-cli
 Or
 deathbian: ~ # apt-get install php5-cli 

To check that our installation was successful, type:

  fher98 @ deathbian: ~ $ php-v
 PHP 5.1.6 (cli) (built: Jul 16 2008 19:53:00)
 Copyright (c) 1997-2006 The PHP Group
 Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies 

Popularity: 4%



Tagged as:

6 Comments

  1. ACTIVATE PHP

  2. estimated

    I have this warning! Please can you help me solve this problem

    root @ you: / # php5-v
    PHP Warning: PHP Startup: Unable to load dynamic library '/ usr/lib/php5/20060613 + lfs / php_mapscript.so' - / usr/lib/php5/20060613 + lfs / php_mapscript.so: shared object can not open file: No such file or directory in Unknown on line 0
    LibClamAV Warning: *********************************************** ************
    LibClamAV Warning: *** This version of the ClamAV engine is outdated. ***
    LibClamAV Warning: *** DO NOT PANIC! Read http://www.clamav.net/support/faq ***
    LibClamAV Warning: *********************************************** ************
    LibClamAV Warning: *********************************************** ************
    LibClamAV Warning: *** This version of the ClamAV engine is outdated. ***
    LibClamAV Warning: *** DO NOT PANIC! Read http://www.clamav.net/support/faq ***
    LibClamAV Warning: *********************************************** ************
    PHP Warning: Can not load module 'pdo_dblib' because required module 'pdo' is not loaded in Unknown on line 0
    PHP 5.2.4-2ubuntu5.7 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 21 2009 19:52:39)
    Copyright (c) 1997-2007 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans

  3. My I get this error:

    Fatal error: Call to undefined function dl () in / usr/local/apache2/htdocs/index1.php on line 4

    May signal that it is due this error???

    Thanks

  4. Thanks for answer .... Actually I'm trying to install mapserver with support for PHPMapscript and when loading the extension php_mapscript.so is where the problem occurs to me ...

    When I create a php file with the following contents:

    I return all the information about php.

    The problem arises when I load the library php_mapscript.so. For this I make a php file with the following code:

    And that's when the browser returns me the following error:

    Fatal error: Call to undefined function dl () in / usr/local/apache2/htdocs/index1.php on line 2

    Thanks again for your help

Please enter a comment

Please note the following:
Comments are moderated, so it can take in being published. No need to repeat his comment.
Your email will never be revealed.

Search terms


  • php script
  • package to run php from command line
  • execute php ubuntu
  • php_mapscript so
  • php script
  • execute php from console windows
  • / usr / bin / env: php: No such file or directory
  • command to install php
  • php command
  • php script
  • execute php from console application
  • install php in ubuntu 9 10
  • #! / usr / bin / env php
  • php command to install red hat
  • command to install php on ubuntu
  • php linux commands
  • command to install on suse
  • as running php on ubuntu
  • how to create a php from console in suse
  • how to install PHP for command line in windows
  • debian php command line
  • run php in ubuntu
  • execute php on windows
  • execute php windows
  • install php in suse
  • install php in ubuntu 9
  • php5 install in opensuse
  • php command line
  • steps for installing php from console linux
  • execute php linux
  • php command line
  • php command line
  • php5-cli
  • activate php-cli
  • centos running php from console
  • cli sapi
  • comand php-cli
  • php command in linux
  • php command windows
  • suse linux commands to open
  • linux commands in php5
  • php file commands
  • php commands
  • script php 5
  • php commands ubuntu
  • php5 command
  • as running a script in ubuntu
  • how to enable php to run php scripts on the command line
  • how to install php from console
  • how to install php console
  • how to install php5-cli ubuntu 9
  • check the installation of php5 centos
  • debian / usr / bin / php
  • run binaries from php
  • execute command from php 5 windows
  • execute linux command from php
  • linux commands execute php
  • php files run fedora
  • execute php console
  • execute php from console