< Previous | Contents | Next >
2.1. Installation
PHP is available in Ubuntu Linux. Unlike python and perl, which are installed in the base system, PHP must be added.
• To install PHP and the Apache PHP module you can enter the following command at a terminal prompt:
sudo apt install php libapache2-mod-php
You can run PHP scripts at a terminal prompt. To run PHP scripts at a terminal prompt you should install the php-cli package. To install php-cli you can enter the following command at a terminal prompt:
sudo apt install php-cli
You can also execute PHP scripts without installing the Apache PHP module. To accomplish this, you should install the php-cgi package. You can run the following command at a terminal prompt to install the php-cgi package:
sudo apt install php-cgi
To use MySQL with PHP you should install the php-mysql package. To install php-mysql you can enter the following command at a terminal prompt:
sudo apt install php-mysql
Similarly, to use PostgreSQL with PHP you should install the php-pgsql package. To install php-pgsql you can enter the following command at a terminal prompt:
sudo apt install php-pgsql