1
votes

I have installed Elementary OS that is basically Ubuntu 14.04 and I want to run php with apache2 server. I have successfully installed apache and php, but I can't see the php files. For example, I saved a phpinfo.php file with the following code

<?php
  phpinfo();
?>

display the following result

enter image description here

When I run php -v it shows the next

PHP 5.5.9-1ubuntu4.9 (cli) (built: Apr 17 2015 11:44:57) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

And for apache2 -v show this

Server version: Apache/2.4.7 (Ubuntu) Server built: Mar 10 2015 13:05:59

So I want to know what is wrong, what should I do to display php files properly?

2
howtogeek.com/howto/ubuntu/installing-php5-and-apache-on-ubuntu Basically Apache doesn't know to feed .php files through the PHP binary to get the output. the missing libapache2-mod-php5 will tell apache how to do so - Will B.

2 Answers

3
votes

Install php as apache module. In ubuntu you can run this

$ sudo apt-get install libapache2-mod-php5
0
votes

This happens because your server doesn't run fastcgi or something else the runs the PHP scripts. make sure you have in your server settings that the fastcgi is pointing to the right php path, and it modified with the right port as well.