# Setting up php on ubuntu and apache2

**URL:** <https://www.phphelp.com/t/setting-up-php-on-ubuntu-and-apache2/33235>\
**Category:** PHP Installation and Configuration\
**Created:** [March 10, 2021, 12:01pm UTC](https://www.phphelp.com/t/setting-up-php-on-ubuntu-and-apache2/33235 "2021-03-10T12:01:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gills4prem](https://www.phphelp.com/user_avatar/www.phphelp.com/gills4prem/32/3506_2.png) [@gills4prem](https://www.phphelp.com/u/gills4prem)\
**Post date:** [March 10, 2021, 12:01pm UTC](https://www.phphelp.com/t/setting-up-php-on-ubuntu-and-apache2/33235/1 "2021-03-10T12:01:03Z")

</div>

Hi I am trying to use php on Ubuntu 20.04.2 LTS, but im having issues trying to get basic php file to run properly(when i open [http://192.168.1.142/info.php](http://192.168.1.142/info.php) but all I see is the php code) I have php 8 running and apache2 is running.

this is the code  
\<?php

```
phpinfo();

?>

```

any help would be great I am trying to use google but not really getting anywhere.

---

<div class="post-metadata">

**Author:** ![skawid](https://www.phphelp.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@skawid](https://www.phphelp.com/u/skawid)\
**Post date:** [March 10, 2021, 3:03pm UTC](https://www.phphelp.com/t/setting-up-php-on-ubuntu-and-apache2/33235/2 "2021-03-10T15:03:29Z")

</div>

Have you installed `mod-php` for apache?

`sudo apt install libapache2-mod-php`  
`sudo a2enmod php8.0`  
`sudo apache2ctl graceful`

These commands will install the apache module to handle PHP; enable the module; and restart apache so that the changes take effect.

---

<div class="post-metadata">

**Author:** ![gills4prem](https://www.phphelp.com/user_avatar/www.phphelp.com/gills4prem/32/3506_2.png) [@gills4prem](https://www.phphelp.com/u/gills4prem)\
**Post date:** [March 10, 2021, 5:10pm UTC](https://www.phphelp.com/t/setting-up-php-on-ubuntu-and-apache2/33235/3 "2021-03-10T17:10:18Z")

</div>

thank you I got fed up with it all so re installed ubuntu and installed using Apache friends and all seems to be working.
