0

I have installed fresh LAMP on Ubuntu 13.10 After installation PHP works fine if i put the PHP code to default localhost web folder /var/www

I created the virtual host. I did it as usually before and never had problems I added the file to /etc/apache2/mods-enabled and activated

but then when i enter this virtual host in browser i can see the code of my index.php file in the browser.

Also when i execute php code from command line i can see source of the code and it is not executed.

What can this be?

4
  • Misconfiguration of apache? Did you execute "php index.php" and you saw the sourcecode? Has index.php start and end php tags? Commented Mar 6, 2014 at 10:52
  • When run from command line i also see the source code instead execution Commented Mar 6, 2014 at 14:40
  • Is the file starting with <?php and ending with ?> tags? Commented Mar 6, 2014 at 16:15
  • yes. starting with <? and ending with ?> Commented Mar 7, 2014 at 5:25

1 Answer 1

2

Try to use <?php and ?> not short tags, or if you want really use that (their use is discouraged due to compatibility issues), ensure that php.ini configuration have:

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

1 Comment

thanks! this was the reason. This option was always off by default. but in ubuntu 13.10 default LAMP installation it is off for some reason.

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.