0

I have a blade running SunOS 5.1 and PHP. There's a problem with it parsing PHP though, and once it hits a =>, such as setting up an array, it starts printing the source to the page.

Example source:

<?php

$tmpVar = 'just testing';
$tmpArray = array(
    'test1' => 'rawr1',
    'test2' => 'rawr2',
    'test3' => 'rawr3'
);

echo "Testing<br/>";    

?>

This would output:

'rawr1', 'test2' => 'rawr2', 'test3' => 'rawr3'); echo "Testing<br/>"; ?>
Nathan
  • 145
  • 1
  • 1
  • 6
  • It would be helpful if you mentioned what webserver you are running, what handlers are assigned to PHP files and how the PHP interpreter is invoked by the webserver. – symcbean Jan 28 '11 at 12:22
  • I'm not the server admin, so I really don't know. I was hoping this would be a generic enough issue for it to be easy to diagnose without that. All I know is that the system is SunOS 5.1, and it's running Apache 2.2 as the Server API. – Nathan Jan 28 '11 at 12:30
  • The output really doesnt make sence to me, seems it is just a part of it. It seems PHP is not parser anyway to me, please write and execute script , can you see php information on page? – Ency Jan 28 '11 at 13:20

4 Answers4

2

As Ency said, are you sure it is parsing PHP at all? It doesn't look like it. It's probably just dumping the entire code and your browser is interpreting it as HTML, seeing the whole thing as one giant tag from <?php to the first > it encounters.

Do the <?php phpinfo(); ?> test.

Also, are you sure the filename is correct? That it actually is called something like index.php, not index.html or index.php.txt or whatever.

From the looks of it, it seems likely PHP has not been enabled at all. Contact the server administrator.

Steven Don
  • 196
  • 1
  • 3
1

What's the file extension of your script file? Is that extension setup to be parsed by PHP? The extension usually should be .php. The output snippet looks like you are using .html instead.

Martin
  • 141
  • 2
0

Either your version of PHP doesn't recognize the <?php tag (try with <? instead?), or more likely the PHP interpreter is not working/started/triggered.

Thus, when loaded the PHP code is interpreted as if it were HTML,

  <?php $tmpVar = 'just testing'; $tmpArray = array('test1' =>

the line above starts with < and ends with >, thus the browser considers it to be a tag, and it is not displayed.

Then the rest is displayed normally...

 'rawr1','test2' => 'rawr2','test3' => 'rawr3'); echo "Testing<br/>"; 

Try with <?, but more likely your have a PHP configuration problem.

Déjà vu
  • 5,408
  • 9
  • 32
  • 52
  • Actually the support for `` is optional while ` – lapo Jan 28 '11 at 14:15
  • We don't know much about his configuration - but as I said it is more likely to be a server configuration problem (PHP not triggered/started) – Déjà vu Jan 28 '11 at 14:17
0

Are you sure that PHP is actually installed? If it is, are you sure that Apache is configured correctly to use PHP?

drewrockshard
  • 1,753
  • 4
  • 20
  • 27