Roman Gelembjuk
Roman Gelembjuk

Reputation: 2005

PHP displays a code in browser rather then execute but only for virtual hosts

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?

Upvotes: 0

Views: 353

Answers (1)

ocirocir
ocirocir

Reputation: 4048

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

Upvotes: 2

Related Questions