PHP is a popular web scripting language. This article will show you how to install PHP on Ubuntu / Debian server.
1. First of all, we update repository.
$ sudo apt-get update
2. Install PHP and Apache web server
$ sudo apt-get install apache2 php5
3. It’s done. You can put your .php source code at /var/www and access http://your_ip from browser.
Now we will do a test. Create test.php file:
$ nano /var/www/test.php
Type these lines:
<?php phpinfo(); ?>
And now open browser and go to this address http://your_ip/test.php
If it shows the following page, that means the PHP is working.
Another step is to install MySQL database with PhpMyAdmin to manage its databases.
4. Install MySQL and PhpMyAdmin
$ sudo apt-get install mysql-server mysql-client phpmyadmin