Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP - Execute code from terminal, ubuntu server

Tags:

terminal

php

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!

like image 271
eatonphil Avatar asked Sep 28 '12 00:09

eatonphil


1 Answers

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

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

like image 150
Jeremy Roman Avatar answered Sep 19 '22 20:09

Jeremy Roman