Apache2 Not Recognizing PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • solitary.wanderer52@gmail.com

    #1

    Apache2 Not Recognizing PHP

    I just finished installing PHP5 on Linux (Debian/Ubuntu/Mepis)/Apache2
    using Synaptic. I have tried creating simple html pages, placing them
    in /var/www and pointing the browser at http://127.0.0.1/(those pages)
    and they are displayed correctly.

    I have created a basic PHP page (abc.php) and it looks like:

    <?
    phpinfo();
    ?>

    This page also exists in the /var/www directory and when I point the
    browser to http://127.0.0.1/abc.php, the page gets loaded into a text
    editor.

    How can I fix this?


    TIA, Steve

  • Mladen Gogala

    #2
    Re: Apache2 Not Recognizing PHP

    On Sat, 04 Nov 2006 19:52:50 -0800, solitary.wander er52 wrote:
    I just finished installing PHP5 on Linux (Debian/Ubuntu/Mepis)/Apache2
    using Synaptic. I have tried creating simple html pages, placing them
    in /var/www and pointing the browser at http://127.0.0.1/(those pages)
    and they are displayed correctly.
    >
    I have created a basic PHP page (abc.php) and it looks like:
    >
    <?
    phpinfo();
    ?>
    >
    This page also exists in the /var/www directory and when I point the
    browser to http://127.0.0.1/abc.php, the page gets loaded into a text
    editor.
    >
    How can I fix this?
    >
    >

    Well, you have to put the instructions to recognize page type into the
    httpd.conf. These instructions usually look like this:

    $ grep -i php /etc/httpd/conf/httpd.conf
    LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
    AddType application/x-httpd-php .php
    $

    My PHP pages execute properly.

    --


    Comment

    • solitary.wanderer52@gmail.com

      #3
      Re: Apache2 Not Recognizing PHP

      Mladen Gogala wrote:
      On Sat, 04 Nov 2006 19:52:50 -0800, solitary.wander er52 wrote:
      >
      I just finished installing PHP5 on Linux (Debian/Ubuntu/Mepis)/Apache2
      using Synaptic. I have tried creating simple html pages, placing them
      in /var/www and pointing the browser at http://127.0.0.1/(those pages)
      and they are displayed correctly.

      I have created a basic PHP page (abc.php) and it looks like:

      <?
      phpinfo();
      ?>

      This page also exists in the /var/www directory and when I point the
      browser to http://127.0.0.1/abc.php, the page gets loaded into a text
      editor.

      How can I fix this?
      >
      >
      Well, you have to put the instructions to recognize page type into the
      httpd.conf. These instructions usually look like this:
      >
      $ grep -i php /etc/httpd/conf/httpd.conf
      LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
      AddType application/x-httpd-php .php
      $
      >
      My PHP pages execute properly.
      >
      --
      http://www.mladen-gogala.com
      Okay, I added the following to my httpd.conf file (which is located in
      /etc/apache2:

      LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
      AddType application/x-httpd-php .php .php5

      When I restart or force-reload the web server, the page loads, but
      displays no info (I am using FF 1.5.0.7). If I have it display source,
      I get:

      <?
      phpinfo();
      ?>

      So, this is an improvement. Any further ideas???


      Steve

      Comment

      • Riemer Palstra

        #4
        Re: Apache2 Not Recognizing PHP

        On 2006-11-06, solitary.wander er52@gmail.com
        <solitary.wande rer52@gmail.com wrote:
        When I restart or force-reload the web server, the page loads, but
        displays no info (I am using FF 1.5.0.7). If I have it display
        source, I get:
        >
        ><?
        phpinfo();
        ?>
        Looks like you don't have short_open_tag support on (which is good,
        actually.) What if you change the first line to say <?php instead of <?

        --
        Riemer Palstra Amsterdam, The Netherlands
        riemer@palstra. com http://www.palstra.com/

        Comment

        • solitary.wanderer52@gmail.com

          #5
          Re: Apache2 Not Recognizing PHP


          Riemer Palstra wrote:
          On 2006-11-06, solitary.wander er52@gmail.com
          <solitary.wande rer52@gmail.com wrote:
          When I restart or force-reload the web server, the page loads, but
          displays no info (I am using FF 1.5.0.7). If I have it display
          source, I get:

          <?
          phpinfo();
          ?>
          >
          Looks like you don't have short_open_tag support on (which is good,
          actually.) What if you change the first line to say <?php instead of <?
          >
          --
          Riemer Palstra Amsterdam, The Netherlands
          riemer@palstra. com http://www.palstra.com/
          ===

          Riemer,

          Thanks so much for your reply. Works like a charm. And now I even
          have phpinfo giving info about mysql, which is what I originally wanted
          before changes on my part seemed to foul everything up.

          Where does one enable short_open_tag and why do you feel that not
          having it is good?

          Thanks again, Steve

          Comment

          • Riemer Palstra

            #6
            Re: Apache2 Not Recognizing PHP

            On 2006-11-06, solitary.wander er52@gmail.com
            <solitary.wande rer52@gmail.com wrote:
            Where does one enable short_open_tag and why do you feel that not
            having it is good?
            Normally you can define it in php.ini or any other place you put your
            PHP configuration directives. In most situations it won't cause any
            harm, but sometimes it could (potentially) cause confusion with XML
            tags.

            --
            Riemer Palstra Amsterdam, The Netherlands
            riemer@palstra. com http://www.palstra.com/

            Comment

            Working...