Apache2 does not interpret PHP

Asked

Viewed 5,001 times

2

I normally installed PHP and APACHE2 but it does not interpret PHP code, follow test code:

<?php echo "teste"; 

It returns me an "html" page with this written, and comes from a "print" written test

Files without find in the /var/www/html folder with 755 permissions I didn’t change anything in the settings of apache2 just gave start

I read about change in httpd.conf file but I can’t find it inside my system

  • 2

    And you put the PHP code inside a file .html? Have you configured Apache to interpret HTML files with PHP? If not, why not a file .php? In fact, avoid using low-level terms around here; no one cares how stressed you are with your code. Be brief and clear, always.

  • Already tested by changing the file extension to . php?

  • @Andersoncarloswoss I apologize now that I saw. Yes I tried to put with an extension . php, but it still returns me as if it were an "HTML", I’m putting in var/www/html, is the problem in the folder...

  • It shouldn’t, if Apache (or another server) is running correctly. You can ask the original code of the file?

  • @Andersoncarloswoss Changed, as I said above I read about some changes in httpd.conf file, however, I am not finding

  • Is the entire file just this PHP line? Is there nothing else in it? Because the image you posted earlier displayed the word "test" on the screen.

  • So the image I had posted was an HTML code with a PHP part... Now to simplify and be more direct I put the file in an extension . php and put to return me a test message... But I haven’t been successful yet because I think APACHE2 is not being able to interpret.

Show 2 more comments

1 answer

3


I had the same problem, I decided to install the apache php module, in my case I use Ubuntu just install this package libapache2-mod-php5

sudo apt-get install libapache2-mod-php5

Browser other questions tagged

You are not signed in. Login or sign up in order to post.