Results 1 to 10 of 10

Thread: PHP parsing problem

  1. #1

    Angry 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

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: PHP parsing problem

    Try removing the space between <? and php.

  3. #3
    Join Date
    Jun 2008
    Location
    United States
    Posts
    423

    Default Re: PHP parsing problem

    Quote Originally Posted by ken_yap View Post
    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>

    Folding@Home
    Help save lives with Folding@Home

  4. #4
    ab@novell.com NNTP User

    Default Re: PHP parsing problem

    -----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-----

  5. #5
    Join Date
    Jun 2008
    Location
    United States
    Posts
    423

    Default Re: PHP parsing problem

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

    PHP Code:
    <html><body><h1>It works!</h1>
    <?php
    php_info
    ();
    ?>
    </body></html>
    That should work better.

    Thank for catching that one, AB.

    Folding@Home
    Help save lives with Folding@Home

  6. #6

    Default Re: PHP parsing problem

    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.

  7. #7
    ab@novell.com NNTP User

    Default Re: PHP parsing problem

    -----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-----

  8. #8
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: PHP parsing problem

    Quote Originally Posted by truenz View Post
    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.
    It's a setting in php.ini and short tags are discouraged for portability reasons now. (Target server may not support it.)

  9. #9

    Unhappy Re: PHP parsing problem

    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!

  10. #10
    Join Date
    Mar 2008
    Location
    Vsters, Sweden ex. Highbury London UK
    Posts
    1,245

    Default Re: PHP parsing problem

    Quote Originally Posted by flrenegado View Post
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •