Install and Test PHP on Linux system

ww‮l.w‬autturi.com
Install and Test PHP on Linux system

To install and test PHP on a Linux system, follow these steps:

  1. Install the PHP package using the package manager for your Linux distribution. For example, on a Debian-based system you can use the apt-get command:
sudo apt-get update
sudo apt-get install php

On a Red Hat-based system, you can use the yum command:

sudo yum update
sudo yum install php
  1. After the installation is complete, you can test PHP by creating a file called test.php in a directory that is accessible by the web server. The file should contain the following code:
<?php
   phpinfo();
?>
  1. To view the output of this script, open a web browser and go to the URL of the test.php file. For example, if the test.php file is located in the root directory of your web server, you can access it at http://localhost/test.php.

  2. If PHP is installed and working correctly, you should see a page containing information about your PHP installation.

Created Time:2017-10-29 22:08:49  Author:lautturi