Source code is displayed on screen and does not run

6

A code of mine gave me a problem and a few excerpts from it appeared on a blank screen when I ran:

Thecodewasright,Ididnotknowwhattheproblemwas,soIwenttotestanothercodethatafewdaysagohadworkedperfectly(Ididnotmodifyitinanyway,Ididnotevenopenthecode)anditdidnotworkeither,sameproblemofexcerptsonscreen:

"; } ?>

What am I doing wrong?

    
asked by anonymous 28.04.2015 / 01:58

1 answer

11

This happens when the short_open_tag ( <? ) does not is enabled on the server, to troubleshoot the problem, change all occurrences of:

<?

for

<?php

Another way is to enable it by php.ini, after the change restart the server.

Change the value:

short_open_tag = Off

To:

short_open_tag = On

Another cause may be wrong access to the file (via browser), it does not work to call the url fil:///c:\projeto\arquivo.php the correct is something like http://localhost/projeto/arquivo.php

    
28.04.2015 / 02:08