Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to install PHP Compiler/Interpreter on ubuntu 11.04

I have latest version of PHP, but I want to learn PHP from terminal. Is there a PHP interpreter available that will run PHP programs inside terminal.

e.g. I want to run command like "phpc" or "phpi" or "php" to open up PHP REPL.


share|improve this question
up vote 11 down vote accepted

Just run

sudo apt-get install php5-cli

To run it in interactive mode:

php -a

Run a file:

php /path/to/file
share|improve this answer
and how to run the compiler/interpreter ? using command php ? – hrishikeshp19 Jan 21 '12 at 18:05

Run the interpreter (there's no compiler in default PHP) using the "php" command, yes. If you'd like to know where "php" comes from (what executable is launched), type

which php

This is likely to give you "/usr/bin/php" as an answer, unless you have a special setup.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.