Adam
Adam

Reputation: 51

Php wont execute

When I create file index.php in directory /public/ my source code

<html>
<meta name="ROBOTS" content="NOARCHIVE">
<head><NOFOLLOW><noindex>
<?php echo '123' ?>
</NOINDEX></NOFOLLOW>
</head>
<body>
</body>
</html>

from browser looks like

<html>
<meta name="ROBOTS" content="NOARCHIVE">
<head><NOFOLLOW><noindex>
123
</NOINDEX></NOFOLLOW>
</head>
<body>
</body>
</html>

but if I create folder (no matter where) and place file index.php into it when source code become

<html>
<meta name="ROBOTS" content="NOARCHIVE">
<head><NOFOLLOW><noindex>

if I make some correction in this file, source code stay the same, not changed in browser view.

Why I cant create and run php code where I want, except /public/ folder?

Upvotes: 0

Views: 111

Answers (1)

Skuli Axelson
Skuli Axelson

Reputation: 524

Is that the exact code you are using in both index.php files?

If so, they should both fail as there is a syntax error. You are missing the ; at the end of the php code.

You posted: <?php echo '123' ?>
Should be : <?php echo '123'; ?>

If that´s not the case, you could add the following to the top of index.php to make sure the errors are showing on the page:

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>

If any error appear after that, please post them back here.

Upvotes: 1

Related Questions