This lesson will show you how to install PHP on Linux systems.
PHP (PHP Hypertext Preprocessor) is an open-source, programming language. Originally designed as a high level scripting language for producing dynamic Web pages, PHP is used mainly in server-side application software.
Task: How to Install PHP
If you are using Fedora Core or Cent Os Linux, type the following command:
# yum install php
If you are using Debian Linux, type the following command:
# apt-get install php5
Now restart Web Server:
# /etc/init.d/httpd restart
Task: Test php
Go to /var/www/html/ directory:
# cd /var/www/html/
Create a php file “phptest.php”
# vi phptest.php
Append following lines:
<?php phpinfo(); ?>
Save and close the file.
Open a web browser and type the url : http://yourdomain.com/phptest.php or http://127.0.0.1/phptest.php or http://localhost/phptest.php or http://server-ip-address/phptest.php.
Hope that will help you and you know how to install php.