0

I have an apache2 server running with all these installed: apache2 php5 php5-gd php-xml-parser php5-intl php5-sqlite php5-mysql smbclient curl libcurl3 php5-curl

I have created a file test.php:

<?php phpinfo(); ?>

On the server, when opened the web page all that appears is the actual php code, when it should look like this:

enter image description here

What is the problem I have looked at the apache logs but nothing looks odd.

Any ideas?

4
  • Is your server turned on? Is the file saved with *.php and in the server dir? Also do you call the file over the server? Commented Feb 1, 2015 at 19:07
  • 3
    This could be just about anything and without insight in your logs and config it is just a guessing game. By the time you have found the right piece of information to share with us, you will probably have found the issue yourself. Commented Feb 1, 2015 at 19:09
  • Have you restarted apache2 after installing php? Commented Feb 1, 2015 at 19:14
  • @GolezTrol I know I have been trolling through google for a long time looking for answers but nobody has it! So as a last resort I posted in on here!! I also think it is quite a common error so we need an answer for it Commented Feb 1, 2015 at 19:42

3 Answers 3

2

Since you're using apache, you need libapache2-mod-php5 to make PHP available to the webserver.

On a debian/ubuntu system, it's generally easiest to use tasksel and select LAMP from there.

Sign up to request clarification or add additional context in comments.

1 Comment

Ha I just found that out myself at exactly the same time!
0

When I have had that problem starting fresh, this has been what I forgot. Create the file .htaccess in the website root (same as phpinfo.php) with the following contents.

#allows these file types to be read and displayed
AddType application/x-httpd-php php php4 php3 html htm

1 Comment

I have put that into my (empty) .htaccess and restarted apache but still not working...
0

Linux, Apache, MySQL, PHP (LAMP) Stacks are pretty simple to setup. Can you maybe link the tutorial you used, so we can see if there are any steps missing?

I would normally use one of these to setup a stack:

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu

http://www.if-not-true-then-false.com/2010/lamp-linux-apache-mysql-php-on-fedora-centos-red-hat-rhel/

http://www.if-not-true-then-false.com/ is rock solid, with loads of theory.

Things that will help us help you:

  • What OS?
  • What Distro?

This normally happens to me if I missed a step in installation.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.