Site icon TestingDocs.com

Testing PHP with Apache Server on Linux

Overview

In this tutorial, we’ll be going through the steps of testing PHP with Apache webserver.

Environment: Ubuntu Server LTS.

Linux Commands

Open command terminal prompt.

Change directory to /var/www/html/

Create a PHP file for example with the name ‘testPHP.php’ file.

$ cd /var/www/
ubuntu:/var/www$ ls
html
ubuntu:/var/www$ cd html/
ubuntu:/var/www/html$ sudo touch testPHP.php
ubuntu:/var/www/html$ sudo gedit testPHP.php

 

 

Test PHP file

Add the sample code to output PHP information.

<?php

phpinfo();

Test on Apache

Restart Apache webserver.  Visit the webpage URL:

http://localhost/testPHP.php

The page should display the PHP Information Apache Information.

 

Exit mobile version