Before you can run any php command from command line make sure you have php5-cli installed on your server. If it is not available, you can install it with the following command.
Open the terminal and type the following.
sudo apt-get install php5-cli
Now next step is to see the lists of extensions installed, type the following command in the terminal.
This show you the list of the extension installed.
Hope that helps.
Stay Digified !!