Interactive console for Ruby, PHP

How to run an interactive console for ruby ​​and php

+48
ruby php
Jan 17 '09 at 16:53
source share
8 answers

For ruby, you want to use the irb command.

For python, you can enter interactive mode using the python command.

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

+96
Jan 17 '09 at 16:59
source share

In addition, if you are working with a Ruby On Rails project, you can use

 ruby script/console 

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

+6
Jan 18 '09 at 4:06
source share

php is not very suitable for an interactive shell because you cannot override functions and classes. Thus, while there is an interactive shell, it is not very useful.

+2
Jan 17 '09 at 18:11
source share

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

+1
Jan 17 '09 at 18:16
source share

you're looking for phpsh , like irb for ruby. php-cli allows you to run scripts for the command line, for example

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

so you ask and all answers to php-cli are different. also php-cli has its own php.ini, which allows you to have different configurations, depends on running php through httpd (e.g. apache) or in bash

Saludos

+1
Jan 18 '09 at 3:28
source share

There is a great script for PHP that allows you to run the php console on a local website.

http://seld.be/notes/php-console-in-your-browser

There are obvious security implications, but if it is only available locally, then there is no need to worry.

It really saves time if you want to double-check the behavior of a function or isolate a piece of code and diagnose what is happening.

+1
Sep 24 '12 at 11:25
source share

For the console with rails the project 3.x + is loaded

 rails c 

this is short for ruby scripts/rails console

See more abbreviations here: http://xyzpub.com/en/ruby-on-rails/3.2/abkuerzungen.html

+1
Nov 01 '13 at 21:40
source share

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

0
Jan 17 '09 at 17:02
source share



All Articles