PHP parsing problem

Hi, I’m new to OpenSuse, coming over from Fedora 8, and I must say it looks and feels like a great OS. However, I have twice now done a clean install of OpenSUSE 11 and then attempted to install apache2/PHP/mySQL (LAMP, via YAST > Patterns > Web and LAMP server).

The install appears to go well, (YAST is great) and apache2 service starts ok, however, I can’t get it to parse a php page. I’ve installed apache/php4 several times previously and managed to get is all running okay, but this apache2/PHP5 has be baffled.

I’ve altered the index.html file that was installed to:
<html><body><h1>It works!</h1>
<? php
php_info();
?>
</body></html>

and renamed to index.php, then tried to access it via http://localhost/index.php. It outputs “It Works!”, but no php info.

Can anyone open my eyes here… ?

TIA

Try removing the space between <? and php.

That should fix the problem.

The full opening tag for PHP scripts is <?php (or <? for short).

So, the PHP_INFO script should look like the following…

<html><body><h1>It works!</h1>
<? php
php_info();
?>
</body></html>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Um… the space still exists in your example.

Good luck.

Unseen-Ghost wrote:
| ken_yap;1846840 Wrote:
|> Try removing the space between <? and php.
|
| That should fix the problem.
|
| The full opening tag for PHP scripts is <?php (or <? for short).
|
| So, the PHP_INFO script should look like the following…
|
|

PHP code:
<html><body><h1>It works!</h1>
<? php
php_info();
?>
</body></html>
--------------------

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIjpkE3s42bA80+9kRApyaAJ9H8jf0Sku2q5qDiija8vCiwKlRwACfTqN0
V3yUC+QTV3V/qU/j5oJdssE=
=Xu07
-----END PGP SIGNATURE-----

Oh…Thank you for that…sorry. This is the corrected version:

<html><body><h1>It works!</h1>
<?php
php_info();
?>
</body></html>

That should work better. :slight_smile:

Thank for catching that one, AB. :slight_smile:

Thanks for that. Sometimes its whats right in front of you that you can’t see!
Note: Using shortened php tag (<?) does not work, only <?php. I presume this must be a php5 requirement. I’ve only ever used p4p4/apache, now have php5/apache2.
Cheers guys.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The shortened tags being off is the default for PHP currently, yes…
shouldn’t be used anyway.

Good luck.

truenz wrote:
| Thanks for that. Sometimes its whats right in front of you that you
| can’t see!
| Note: Using shortened php tag (<?) does not work, only <?php. I presume
| this must be a php5 requirement. I’ve only ever used p4p4/apache, now
| have php5/apache2.
| Cheers guys.
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIkdJ/3s42bA80+9kRAsKEAJ0WWOCRBpBwB9EtF3LoaXiBx88soACeLaMA
QwCDoW1YPEGSwc/4Act/+j8=
=6qZS
-----END PGP SIGNATURE-----

It’s a setting in php.ini and short tags are discouraged for portability reasons now. (Target server may not support it.)

hello!

Im new to linux, I’ve installed apache2,php5 and mysql using yast. Im trying to run my first php script “hello world” but when I tried to open it by clicking, a window asking for open with… comes out. When I opened it using firefox a blank output came out. Please help!

You have probably missed the apache php mod.
Have a look in yast/software for php and you will find it.
And please start a new thread, don’t hijack…

/Geoff