PHP broken in 11.2 ?

Hi,

I’m trying to get PHP working. I have installed a new OpenSuSE 11.2 box. I
have installed all the packages with ‘php’ in the title in YaST, but I can’t
get php to work at all.

If from a command prompt I type :

php test.php

Where test.php contains :

<?
phpinfo();

print ‘<HTML><BODY><H1>Hello World</H1></BODY></HTML>’;

?>

I just get the script echoed as if I had typed cat test.php

What the hell am I doing wrong ? this works fine in 10.x, incase it maters I
am logged in as root, though I have also tried as a normal user and get the
same results.

Cheers.

Phill.

Short tags default config hasn’t allowed that for a while.

“Phill Harvey-Smith” <phill@bio.warwick.ac.uk> wrote in
news:Xns9CD59C9DBA2F8philldnawarwickacuk@130.57.5.50:

[SNIP!]

> What the hell am I doing wrong ? this works fine in 10.x, incase it
> maters I am logged in as root, though I have also tried as a normal
> user and get the same results.

Being incredibly stupid :frowning: should of course have been <?php phpinfo(); ?>

Humm this must be a new change it didn’t used to be that way :frowning:

Doh!

Phill.

1st of all update your code from this:

<?
phpinfo();

print '<HTML><BODY><H1>Hello World</H1></BODY></HTML>';

?>

to this:

<?php
phpinfo();
?>

OR

<?php
echo "Hello World";
?>

Next if you want to run it in terminal, give the absolute path like:

php /var/www/test.php

Next make sure Apache server is installed too.

Hope this helps.

You could change the value of "short_open_tag " in php.ini from “Off” to “On”.

Do note that this bad practice and its use is frowned upon as hardly any host ‘out there in the wild’ has it enabled. Resulting in your scripts being far less portable.

My advice is to stick to what you did, use <?php instead of <?.
Should you wish to enable it after all, php.ini’s location should be listed in YaST when you select the PHP package and open up the ‘file list’ tab.

You should stop using short tags. IIRC it’s going away (I seem to remember it on a list of options that will cause a deprecation warning in 5.3).