How to Install PHP Commands in Karmic
Karmic Koala is the code name for Ubuntu 9.10, released in October 2009 and following the standard animal-themed naming system for Ubuntu Linux distributions. Like many versions of Linux, Ubuntu has a package available for easy installation of the PHP command line interface, or CLI. Installing the PHP CLI allows you to run PHP commands directly from the command line, and write PHP scripts to automate common administration tasks. Install the PHP CLI using apt, which will keep the CLI version up to date by installing upgrades automatically.
Instructions
-
-
1
Log in to your server using SSH if you are using Ubuntu Server. Click "Applications" at the top-left of the screen, and then click on "Accessories" and "Terminal" if you are using Ubuntu Desktop.
-
2
Type "sudo apt-get install php5-cli" at the terminal prompt to install the PHP5 command line package from the Ubuntu package repository. The "sudo" command allows you to install the PHP CLI as the root user.
-
-
3
Type "php -v" at the terminal prompt to verify the PHP CLI has installed correctly. You should see output similar to:
PHP 5.2.4-2ubuntu5.17 with Suhosin-Patch 0.9.6.2 (cli) (built: May 4 2011 09:46:14)
The "(cli)" text shows the command line interface has been installed.
-
4
Type "php ./script.php" to run a PHP script from the command line, replacing "script.php" with the file name of the PHP script.
-
1
Tips & Warnings
Type "which php" at the terminal prompt to find the location of the PHP binaries.
References
Resources
- Photo Credit Polka Dot RF/Polka Dot/Getty Images