How do you start the Interactive Console for ruby and php
8 Answers
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.
1 Comment
ruby script/rails console (rails version > 3)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.
Comments
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
Comments
There is an excellent script for PHP that allows you to run a php console on a local website.
http://seld.be/notes/php-console-in-your-browser
There's obvious security implications here, but if it's only accessible locally, then there's no need to worry.
Really saves time if you want to double check the function behaviour, or to isolate a piece of code and diagnose what happens.
Comments
For a console with a rails 3.x+ project loaded
rails c
this is shorthand for ruby scripts/rails console
See more abbreviations here: http://xyzpub.com/en/ruby-on-rails/3.2/abkuerzungen.html