I have tried to execute simple php code in the php interpreter.
When I executed the command php -a
I getting the message
Interactive mode enabled
Without any place for php input.
But I can execute a php code through the command php -r
.
for example:
php -r "echo 'Hello stackoverflow!';"
Hello stackoverflow!
A command interpreter is the part of a computer operating system that understands and executes commands that are entered interactively by a human being or from a program. In some operating systems, the command interpreter is called the shell.
Command Prompt is a command line interpreter application available in most Windows operating systems. It's used to execute entered commands. Most of those commands automate tasks via scripts and batch files, perform advanced administrative functions, and troubleshoot or solve certain kinds of Windows issues.
Examples of command-line interpreters include DEC's DIGITAL Command Language (DCL) in OpenVMS and RSX-11, the various Unix shells (sh, ksh, csh, tcsh, zsh, Bash, etc.), CP/M's CCP, DOS' COMMAND.COM, as well as the OS/2 and the Windows CMD.
It's literally an interpreter of commands. Unlike a program that has a graphical user interface (GUI) like buttons and menus that are controlled by a mouse, a command line interpreter accepts lines of text from a keyboard as the commands and then converts those commands into functions that the OS understands.
Install this:
php5-readline
then try use:
php -a
type php -m
and make sure you have the readline module. If you don't you won't be able to use it.
http://www.php.net/manual/en/features.commandline.interactive.php
As of PHP 5.1.0, the CLI SAPI provides an interactive shell using the -a option if PHP is compiled with the --with-readline option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With