PHP does not parse .PHP files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Phong Ho

    PHP does not parse .PHP files

    I have this problem with PHP that someone might be able to help.

    With CLI, I am able to execute my .php files. For example, if I type
    "php phpinfo.php" , this works fine on my system.

    If I put the phpinfo.php file is in /var/www/html and I try to access
    it through the browser, I get the content of the file and not the
    execution of the file. Instead of display the info of PHP, I got the
    text of the file as:

    <?php
    phpinfo();
    ?>


    Why?
    Thanks
  • Margaret MacDonald

    #2
    Re: PHP does not parse .PHP files

    Phong Ho wrote:
    [color=blue]
    >I have this problem with PHP that someone might be able to help.
    >
    >With CLI, I am able to execute my .php files. For example, if I type
    >"php phpinfo.php" , this works fine on my system.
    >
    >If I put the phpinfo.php file is in /var/www/html and I try to access
    >it through the browser, I get the content of the file and not the
    >execution of the file. Instead of display the info of PHP, I got the
    >text of the file as:
    >
    ><?php
    > phpinfo();
    >?>
    >
    >
    >Why?
    >Thanks[/color]

    Do you have a webserver such as Apache running on the machine where
    you expect this to happen? Because it's the webserver, not the
    browser, that needs to know about php. The browser only does html.

    Margaret
    --
    (To mail me, please change .not.invalid to .net, first.
    Apologies for the inconvenience.)

    Comment

    • steve

      #3
      Re: PHP does not parse .PHP files

      "Phong Ho" wrote:[color=blue]
      > I have this problem with PHP that someone might be able to help.
      >
      > With CLI, I am able to execute my .php files. For example, if I[/color]
      type[color=blue]
      > "php phpinfo.php" , this works fine on my system.
      >
      > If I put the phpinfo.php file is in /var/www/html and I try to[/color]
      access[color=blue]
      > it through the browser, I get the content of the file and not the
      > execution of the file. Instead of display the info of PHP, I got[/color]
      the[color=blue]
      > text of the file as:
      >
      > <?php
      > phpinfo();
      > ?>
      >
      >
      > Why?
      > Thanks[/color]

      Is that directory in the path of your webserver’s htdocs directory?
      CLI is not sensitive to this, but php executed as a webpage is.

      --
      http://www.dbForumz.com/ This article was posted by author's request
      Articles individually checked for conformance to usenet standards
      Topic URL: http://www.dbForumz.com/PHP-parse-fi...ict131346.html
      Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=438212

      Comment

      • Pedro Graca

        #4
        Re: PHP does not parse .PHP files

        Phong Ho wrote:[color=blue]
        > I have this problem with PHP that someone might be able to help.
        >
        > With CLI, I am able to execute my .php files. For example, if I type
        > "php phpinfo.php" , this works fine on my system.
        >
        > If I put the phpinfo.php file is in /var/www/html and I try to access
        > it through the browser, I get the content of the file and not the
        > execution of the file. Instead of display the info of PHP, I got the
        > text of the file as:
        >
        ><?php
        > phpinfo();
        > ?>
        >
        >
        > Why?[/color]

        You have to access the file through your /correctly configured/ server



        and not through the file system

        *this does not work*
        file:///var/www/html/phpinfo.php


        --
        USENET would be a better place if everybody read: | to email me: use |
        http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
        http://www.netmeister.org/news/learn2quote2.html | header, textonly |
        http://www.expita.com/nomime.html | no attachments. |

        Comment

        • Phong Ho

          #5
          Re: PHP does not parse .PHP files

          Let me clarify this. The path of my Apache webserver is at
          /var/www/html and I have a .php test file in this directory.

          When I try to access to my test file through the browser
          using http://localhost/phpinfo.php

          I got:
          <?php
          phpinfo();
          ?>

          Basically, Apache is sending the .php file without interpreting it
          first.

          I look at my httpd.conf file, I do have the right setting:

          LoadModule php4_module libexec/libphp4.so
          AddType application/x-httpd-php .php .phtml

          I suspect Apache fails to load the libphp4.so at startup. How do I
          verify that
          Apache did load libphp4.so? I believe I have to use ld command but I
          am not sure!!

          I use Apache 2.0.x and php.4.3.x

          Thanks




          Pedro Graca <hexkid@hotpop. com> wrote in message news:<slrncfqh2 p.1od.hexkid@ID-203069.user.uni-berlin.de>...[color=blue]
          > Phong Ho wrote:[color=green]
          > > I have this problem with PHP that someone might be able to help.
          > >
          > > With CLI, I am able to execute my .php files. For example, if I type
          > > "php phpinfo.php" , this works fine on my system.
          > >
          > > If I put the phpinfo.php file is in /var/www/html and I try to access
          > > it through the browser, I get the content of the file and not the
          > > execution of the file. Instead of display the info of PHP, I got the
          > > text of the file as:
          > >
          > ><?php
          > > phpinfo();
          > > ?>
          > >
          > >
          > > Why?[/color]
          >
          > You have to access the file through your /correctly configured/ server
          >
          > http://localhost/phpinfo.php
          >
          > and not through the file system
          >
          > *this does not work*
          > file:///var/www/html/phpinfo.php[/color]

          Comment

          • Anders K. Madsen

            #6
            Re: PHP does not parse .PHP files

            On 20 Jul 2004 22:01:19 -0700
            peter_ho98@yaho o.com (Phong Ho) wrote:
            [color=blue]
            > Let me clarify this. The path of my Apache webserver is at
            > /var/www/html and I have a .php test file in this directory.
            >
            > When I try to access to my test file through the browser
            > using http://localhost/phpinfo.php
            >
            > I got:
            > <?php
            > phpinfo();
            > ?>
            >
            > Basically, Apache is sending the .php file without interpreting it
            > first.
            >
            > I look at my httpd.conf file, I do have the right setting:
            >
            > LoadModule php4_module libexec/libphp4.so
            > AddType application/x-httpd-php .php .phtml
            >
            > I suspect Apache fails to load the libphp4.so at startup. How do I
            > verify that
            > Apache did load libphp4.so? I believe I have to use ld command but I
            > am not sure!!
            >
            > I use Apache 2.0.x and php.4.3.x
            >[/color]

            Have you remembered to restart apache after changing the configuration?
            If apache can't load the php-module it'll complain at startup I
            believe...

            Madsen

            --
            Anders K. Madsen --- http://lillesvin.linux.dk

            "There are 10 types of people in the world.
            Those who understand binary - and those who don't."

            -----BEGIN PGP SIGNATURE-----
            Version: GnuPG v1.2.4 (GNU/Linux)

            iD8DBQFA/ftylNHJe/JASHcRAiCSAJ9Yu WIu5XObLQBNNgLq 8mEsbfGeJACfWEN I
            oygV1qgzLJkTrsh hyoGheuA=
            =u/gP
            -----END PGP SIGNATURE-----

            Comment

            • Phong Ho

              #7
              Re: PHP does not parse .PHP files

              Of course, I use apachectl stop, start and restart. Apache does not
              complain about anything.
              Does anyone have Apache 2.0.x, php.4.3.x and MySQL 4.0.x on Fedora 1.0
              to work properly?
              Thanks


              "Anders K. Madsen" <madsen@lillesv in.linux.dk> wrote in message news:<200407210 71319.7eda0008@ lapsvin>...[color=blue]
              > On 20 Jul 2004 22:01:19 -0700
              > peter_ho98@yaho o.com (Phong Ho) wrote:
              >[color=green]
              > > Let me clarify this. The path of my Apache webserver is at
              > > /var/www/html and I have a .php test file in this directory.
              > >
              > > When I try to access to my test file through the browser
              > > using http://localhost/phpinfo.php
              > >
              > > I got:
              > > <?php
              > > phpinfo();
              > > ?>
              > >
              > > Basically, Apache is sending the .php file without interpreting it
              > > first.
              > >
              > > I look at my httpd.conf file, I do have the right setting:
              > >
              > > LoadModule php4_module libexec/libphp4.so
              > > AddType application/x-httpd-php .php .phtml
              > >
              > > I suspect Apache fails to load the libphp4.so at startup. How do I
              > > verify that
              > > Apache did load libphp4.so? I believe I have to use ld command but I
              > > am not sure!!
              > >
              > > I use Apache 2.0.x and php.4.3.x
              > >[/color]
              >
              > Have you remembered to restart apache after changing the configuration?
              > If apache can't load the php-module it'll complain at startup I
              > believe...
              >
              > Madsen[/color]

              Comment

              • Phong Ho

                #8
                Re: PHP does not parse .PHP files

                Fedora uses by default the httpd.conf in /etc/httpd/conf . It does not
                use the httpd.conf in /usr/local/apache2/conf as I thought.

                "Anders K. Madsen" <madsen@lillesv in.linux.dk> wrote in message news:<200407210 71319.7eda0008@ lapsvin>...[color=blue]
                > On 20 Jul 2004 22:01:19 -0700
                > peter_ho98@yaho o.com (Phong Ho) wrote:
                >[color=green]
                > > Let me clarify this. The path of my Apache webserver is at
                > > /var/www/html and I have a .php test file in this directory.
                > >
                > > When I try to access to my test file through the browser
                > > using http://localhost/phpinfo.php
                > >
                > > I got:
                > > <?php
                > > phpinfo();
                > > ?>
                > >
                > > Basically, Apache is sending the .php file without interpreting it
                > > first.
                > >
                > > I look at my httpd.conf file, I do have the right setting:
                > >
                > > LoadModule php4_module libexec/libphp4.so
                > > AddType application/x-httpd-php .php .phtml
                > >
                > > I suspect Apache fails to load the libphp4.so at startup. How do I
                > > verify that
                > > Apache did load libphp4.so? I believe I have to use ld command but I
                > > am not sure!!
                > >
                > > I use Apache 2.0.x and php.4.3.x
                > >[/color]
                >
                > Have you remembered to restart apache after changing the configuration?
                > If apache can't load the php-module it'll complain at startup I
                > believe...
                >
                > Madsen[/color]

                Comment

                Working...