eatonphil
eatonphil

Reputation: 13682

PHP - Execute code from terminal, ubuntu server

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!

Upvotes: 17

Views: 57225

Answers (3)

schurpf
schurpf

Reputation: 609

php -r 'phpinfo();'

worked for me on OSX.

Upvotes: 12

Jeremy Roman
Jeremy Roman

Reputation: 16355

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

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

Upvotes: 45

Hammo
Hammo

Reputation: 182

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

Upvotes: -2

Related Questions