Problem getting started with PHP after installing Apache and PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coaa
    New Member
    • Apr 2007
    • 3

    Problem getting started with PHP after installing Apache and PHP

    It pains me to ask such a dumb question but...

    I already use PHP widely on a host server but I want to pre-test scripts on my (Windows) machine. I installed Apache(2_2) without problems but, having then installed PHP5 (Windows binary) carefully following instructions (default settings), it shows me the raw PHP code not the interpreted stuff. Even if I run PHP from a command line with a minimal script, it still shows me the raw code and not what I want to see, so it does not seem to be anything to do with my Apache installation/config.

    Troubleshooting guides just say "make sure that it shows you..." but it does not. I have searched for an answer - honestly.

    TIA
    Bev
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    You sure that your Apache configuration (in httpd.conf) does recognize the PHP extension? Do you have in there one or more ADDTYPE statements that look like
    Code:
    AddType application/x-httpd-php .php
    Ronald :cool:

    Comment

    • coaa
      New Member
      • Apr 2007
      • 3

      #3
      Originally posted by ronverdonk
      You sure that your Apache configuration (in httpd.conf) does recognize the PHP extension? Do you have in there one or more ADDTYPE statements that look like
      Code:
      AddType application/x-httpd-php .php
      Ronald :cool:
      Yes, precisely that line is there. But if it was just Apache's config, then using PHP from the command line to open the file should still give me the result and not the source code, which is what I get.

      There must be a beginner's 'gotcha' in there somewhere.

      Bev

      Comment

      • coaa
        New Member
        • Apr 2007
        • 3

        #4
        In case anyone treads this way again, it turned out that all my legacy PHP used "<?" to introduce the script instead of "<?php". I *now* know that the default is not to accept that.

        Bev

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Thanks for sharing this experience with us.

          Ronald :cool:

          Comment

          • Motoma
            Recognized Expert Specialist
            • Jan 2007
            • 3236

            #6
            Apache 2 will only run with PHP 5.2 or greater.
            I usually use the WAMP5 package to install these in a windows environment.

            Originally posted by coaa
            It pains me to ask such a dumb question but...

            I already use PHP widely on a host server but I want to pre-test scripts on my (Windows) machine. I installed Apache(2_2) without problems but, having then installed PHP5 (Windows binary) carefully following instructions (default settings), it shows me the raw PHP code not the interpreted stuff. Even if I run PHP from a command line with a minimal script, it still shows me the raw code and not what I want to see, so it does not seem to be anything to do with my Apache installation/config.

            Troubleshooting guides just say "make sure that it shows you..." but it does not. I have searched for an answer - honestly.

            TIA
            Bev

            Comment

            Working...