17

I know that you can run php files from terminal with linux running PHP... I.e. "php script.php" ... But is there any program that allows you to directly input php into the terminal (through any intermediary program) and output the results? I.e. In terminal, testing php globals like getinfo(), etc..? Any help would be great, I'd like to test functions and commands through a sort of run-time terminal. Thanks!

3 Answers 3

45

php -a (as of PHP 5.1) should do what you want.

http://php.net/manual/en/features.commandline.interactive.php

Sign up to request clarification or add additional context in comments.

3 Comments

If you type 'php -a' and get a response of 'Interactive Shell' followed by a 'php>' prompt, you have interactive shell available (PHP was compiled with readline support). If instead you get a response of 'Interactive mode enabled', you DO NOT have interactive shell available... link Without the shell you can try the suggested method here
@CrandellWS Thanks very much for the tip!!! I got that Interactive mode enabled and didn't know about that.
what about a .php file?\
12
php -r 'phpinfo();'

worked for me on OSX.

-2

You might like a program called PHP Shell Terminal: http://sourceforge.net/projects/phpterm/

1 Comment

This is more like an SSH client written in PHP than a tool for debugging PHP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.