0

Today I installed Php 5.6.5 on my server running Debian 7 Wheezy and Apache2.

First, I added these repositories to my /etc/apt/sources.list file:

http://packages.dotdeb.org wheezy-php56
http://packages.dotdeb.org wheezy-php56 all

Second, I added a missing key with these commands:

apt-get install debian-keyring
gpg --keyserver pgp.mit.edu --recv-keys ***[the_key]***
gpg --armor --export ***[the_key]*** | apt-key add -

Finally, I installed Php 5.6.5 with this command:

apt-get install php5

Then I checked the Php's version with the command php -v, and the terminal returned the right version.

So I created an example php page to make a test. Its directory is /var/www/index.php and its code is it:

<?php phpinfo(); ?> 

But it doesn't work, it shows a completely blank page.

I tried with other Php scripts, but it converts the php code to plain text.

Where's the problem?

What should I do to fix it?

Here's the solution

I enabled the apache module for Php with this command:

  • a2enmod php5

Then I restarted the apache service and now everything works fine.

Maury
  • 11
  • 5

1 Answers1

1

You have php, but not the apache module for php

apt-get install libapache2-mod-php5

You may need to enable the module...

a2enmod php5

Restart apache and you should be good to go.

Without this module, apache doesn't do anything special with PHP, and just passes it through as text. You saw a blank page for <?php phpinfo() ?> as that looks like an empty XML document (view source will reveal all)

Paul Dixon
  • 1,516
  • 3
  • 23
  • 37