tags:

views:

1220

answers:

6

How do you start the Interactive Console for ruby and php

+16  A: 

For ruby, you want the 'irb' command.

For python, you can enter interactive mode with the 'python' command.

For php, you enter a basic interactive mode with 'php -a'. Because of its limitations, other interactive shells have sprung up. PHP-Shell is one of them.

Gordon Wilson
A: 

In php its php or php-cli - different name in different installations

empi
+1  A: 

php doesn't lend itself very well to an interactive shell, because you can't redefine functions and classes. So while there is an interactive shell available, it's not very useful.

troelskn
A: 

Make sure you have php5-cli installed and type 'php -a' at the command line.

Robert Elwell
A: 

you are looking for phpsh same as irb for ruby. php-cli allow you to run scripts for the command line like

myserver> php -r "echo 'hola mundo';"

so what you are asking and all replies about php-cli are different. also php-cli has it own php.ini that allow you to have differents configurations depends of run php over httpd (like apache) or in bash

saludos

Gabriel Sosa
+3  A: 

Also, if you are working with a Ruby On Rails project you could use

ruby script/console

from your Rails application root. This is a good approach since you get an interactive ruby shell and the advantage is that loads the entire application stack for you. Pretty handy if you are testing your new code or trying to debug something.

Attila Györffy