Need help on PHP

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

    #1

    Need help on PHP

    Hi, I begin to write PHP but run into problem already.
    First, I do not know where to put my PHP code? Where is the IIS Root
    Directory? (I'm using Windows XP).

    I have run Installer... but when I open my browser and type:
    http://localhost/hello.php, what I got is an error message:

    <p>This PHP CGI binary was compiled with force-cgi-redirect enabled.
    This
    means that a page will only be served up if the REDIRECT_STATUS CGI
    variable is
    set, e.g. via an Apache Action directive.</p>
    <p>For more information as to <i>why</i> this behaviour exists, see the
    <a href="http://php.net/security.cgi-bin">manual page for CGI
    security</a>.</p>
    <p>For more information about changing this behaviour or re-enabling
    this webserver,
    consult the installation file that came with this distribution, or
    visit
    <a href="http://php.net/install.windows ">the manual page</a>.</p>

    I really do not understand how to make my first PHP "Hello World"
    works?

    I will greatly appreciate of your help!
    Thank you!

    -Ted

  • WhatsPHP

    #2
    Re: Need help on PHP


    teddybear wrote:
    [color=blue]
    > Hi, I begin to write PHP but run into problem already.
    > First, I do not know where to put my PHP code? Where is the IIS Root
    > Directory? (I'm using Windows XP).[/color]

    Your root directory is c:\Inetpub\wwwr oot

    Comment

    • teddybear
      New Member
      • Jun 2006
      • 6

      #3
      Thanks for your suggestion on the root directory. Now I have put it there, but still gave me error with the same message when I call it from the web browser: http://127.0.0.1/hello.php.

      Here is the error message:
      <p>This PHP CGI binary was compiled with force-cgi-redirect enabled.
      This
      means that a page will only be served up if the REDIRECT_STATUS CGI
      variable is
      set, e.g. via an Apache Action directive.</p>
      <p>For more information as to <i>why</i> this behaviour exists, see the
      <a href="http://php.net/security.cgi-bin">manual page for CGI
      security</a>.</p>
      <p>For more information about changing this behaviour or re-enabling
      this webserver,
      consult the installation file that came with this distribution, or
      visit
      <a href="http://php.net/install.windows ">the manual page</a>.</p>

      I do not know where to fix??

      Comment

      • teddybear

        #4
        Re: Need help on PHP

        WhatsPHP wrote:[color=blue]
        > teddybear wrote:
        >[color=green]
        > > Hi, I begin to write PHP but run into problem already.
        > > First, I do not know where to put my PHP code? Where is the IIS Root
        > > Directory? (I'm using Windows XP).[/color]
        >
        > Your root directory is c:\Inetpub\wwwr oot[/color]

        Thanks for reminding me that I have to put my hello.php in the
        C:\Inetpub\wwwr oot folder. I have put it there, but when I try to call
        with http://127.0.0.1/hello.php,

        the problem still there, it said:

        <p>This PHP CGI binary was compiled with force-cgi-redirect enabled.
        This
        means that a page will only be served up if the REDIRECT_STATUS CGI
        variable is
        set, e.g. via an Apache Action directive.</p>
        <p>For more information as to <i>why</i> this behaviour exists, see the
        <a href="http://php.net/security.cgi-bin">manual page for CGI
        security</a>.</p>
        <p>For more information about changing this behaviour or re-enabling
        this webserver,
        consult the installation file that came with this distribution, or
        visit
        <a href="http://php.net/install.windows ">the manual page</a>.</p>

        What is the problem? Can it be that I have to point in the PATH where
        the PHP compiler is? Or should I modify the REDIRECT_STATUS CGI
        variable as stated above, and where I can find the REDIRECT_STATUS
        variable?
        Please help and thank you!

        --Ted

        Comment

        • WhatsPHP

          #5
          Re: Need help on PHP

          This PHP CGI binary was compiled with force-cgi-redirect enabled. This
          means that a page will only be served up if the REDIRECT_STATUS CGI
          variable is set, e.g. via an Apache Action directive.

          First thing you need to do is change the line in php.ini so it is
          cgi.force_redir ect = Off

          Then - and this is where I tore my hair out for a while - if you have
          your php.ini in the /windows directory, ensure there there isn't also a
          default php.ini in the PHP directory as it seems to read that one
          first.

          Or, why not just have it in the PHP directory and save a lot of
          heartache :o)

          Comment

          • teddybear
            New Member
            • Jun 2006
            • 6

            #6
            Okay, I read and follow your reply... I found there is PHP.ini in my /windows directory. And then, I found out that there is also another PHP.ini in my /PHP directory.

            Your suggestion is to DELETE the one inside windows directory. Do I interpret your suggestion correctly?

            And then, change the cgi.force_redir ect = 0?

            Here is the section regarding cgi.force_redir ect from PHP.ini inside /PHP folder:
            ----
            ; cgi.force_redir ect is necessary to provide security running PHP as a CGI under
            ; most web servers. Left undefined, PHP turns this on by default. You can
            ; turn it off here AT YOUR OWN RISK
            ; **You CAN safely turn this off for IIS, in fact, you MUST.**
            ; cgi.force_redir ect = 1
            ------

            And here is the one inside my PHP.ini in the /Windows folder:
            ------
            ; cgi.force_redir ect is necessary to provide security running PHP as a CGI under
            ; most web servers. Left undefined, PHP turns this on by default. You can
            ; turn it off here AT YOUR OWN RISK
            ; **You CAN safely turn this off for IIS, in fact, you MUST.**
            ; cgi.force_redir ect = 1
            cgi.force_redir ect = 0

            -----

            The one in the /windows directory says cgi.force_redir ect = OFF?
            While the one in the /PHP directory is commented, so it has no effect.

            Now, what else I have to do if I have to let only the one in /PHP directory, if there are more steps to be done... should I restart my computer so the modified PHP.ini have the effect?

            Thanks...

            --Ted
            Last edited by teddybear; Jun 22 '06, 08:28 PM.

            Comment

            • teddybear

              #7
              Re: Need help on PHP

              I have replied you on the scripts.com forum. Thanks, and I am looking
              forward to your reply!

              WhatsPHP wrote:[color=blue]
              > This PHP CGI binary was compiled with force-cgi-redirect enabled. This
              > means that a page will only be served up if the REDIRECT_STATUS CGI
              > variable is set, e.g. via an Apache Action directive.
              >
              > First thing you need to do is change the line in php.ini so it is
              > cgi.force_redir ect = Off
              >
              > Then - and this is where I tore my hair out for a while - if you have
              > your php.ini in the /windows directory, ensure there there isn't also a
              > default php.ini in the PHP directory as it seems to read that one
              > first.
              >
              > Or, why not just have it in the PHP directory and save a lot of
              > heartache :o)[/color]

              Comment

              • teddybear
                New Member
                • Jun 2006
                • 6

                #8
                Well, I am not aware that this forum apparently link to the one in google group.

                Now, I got different problem. I have set the PHP.ini in the \PHP directory with
                cgi.force_redir ect = 0

                So, that should override the one in the /windows directory. But when I call my hello.php, my browser said: "Page Could Not Be Found"

                Why is it so? I already put my Hello.php both in the /wwwroot directory and /PHP directory...

                Another problem again and do not know where to fix? Please help!
                Thanks!

                Comment

                • teddybear

                  #9
                  Re: Need help on PHP

                  I have another problem now. My browser said "Page Coult Not Be Found".
                  However I have set cgi.force_redir ect = 0 in the PHP.ini inside /PHP
                  directory,
                  And I have put Hello.PHP both in the /wwwroot directory and /PHP
                  directory.
                  Can you please suggest me what is the problem this time?

                  Thank you for help!

                  --Ted

                  teddybear wrote:[color=blue]
                  > I have replied you on the scripts.com forum. Thanks, and I am looking
                  > forward to your reply!
                  >
                  > WhatsPHP wrote:[color=green]
                  > > This PHP CGI binary was compiled with force-cgi-redirect enabled. This
                  > > means that a page will only be served up if the REDIRECT_STATUS CGI
                  > > variable is set, e.g. via an Apache Action directive.
                  > >
                  > > First thing you need to do is change the line in php.ini so it is
                  > > cgi.force_redir ect = Off
                  > >
                  > > Then - and this is where I tore my hair out for a while - if you have
                  > > your php.ini in the /windows directory, ensure there there isn't also a
                  > > default php.ini in the PHP directory as it seems to read that one
                  > > first.
                  > >
                  > > Or, why not just have it in the PHP directory and save a lot of
                  > > heartache :o)[/color][/color]

                  Comment

                  • teddybear

                    #10
                    Re: Need help on PHP

                    My friend, where are you going? Anybody out there, please help???
                    I am stuck...

                    teddybear wrote:[color=blue]
                    > I have another problem now. My browser said "Page Coult Not Be Found".
                    > However I have set cgi.force_redir ect = 0 in the PHP.ini inside /PHP
                    > directory,
                    > And I have put Hello.PHP both in the /wwwroot directory and /PHP
                    > directory.
                    > Can you please suggest me what is the problem this time?
                    >
                    > Thank you for help!
                    >
                    > --Ted
                    >
                    > teddybear wrote:[color=green]
                    > > I have replied you on the scripts.com forum. Thanks, and I am looking
                    > > forward to your reply!
                    > >
                    > > WhatsPHP wrote:[color=darkred]
                    > > > This PHP CGI binary was compiled with force-cgi-redirect enabled. This
                    > > > means that a page will only be served up if the REDIRECT_STATUS CGI
                    > > > variable is set, e.g. via an Apache Action directive.
                    > > >
                    > > > First thing you need to do is change the line in php.ini so it is
                    > > > cgi.force_redir ect = Off
                    > > >
                    > > > Then - and this is where I tore my hair out for a while - if you have
                    > > > your php.ini in the /windows directory, ensure there there isn't also a
                    > > > default php.ini in the PHP directory as it seems to read that one
                    > > > first.
                    > > >
                    > > > Or, why not just have it in the PHP directory and save a lot of
                    > > > heartache :o)[/color][/color][/color]

                    Comment

                    • william.clarke

                      #11
                      Re: Need help on PHP


                      teddybear wrote:[color=blue]
                      > My friend, where are you going? Anybody out there, please help???
                      > I am stuck...
                      >
                      > teddybear wrote:[color=green]
                      > > I have another problem now. My browser said "Page Coult Not Be Found".
                      > > However I have set cgi.force_redir ect = 0 in the PHP.ini inside /PHP
                      > > directory,
                      > > And I have put Hello.PHP both in the /wwwroot directory and /PHP
                      > > directory.
                      > > Can you please suggest me what is the problem this time?
                      > >
                      > > Thank you for help!
                      > >
                      > > --Ted
                      > >
                      > > teddybear wrote:[color=darkred]
                      > > > I have replied you on the scripts.com forum. Thanks, and I am looking
                      > > > forward to your reply!
                      > > >
                      > > > WhatsPHP wrote:
                      > > > > This PHP CGI binary was compiled with force-cgi-redirect enabled. This
                      > > > > means that a page will only be served up if the REDIRECT_STATUS CGI
                      > > > > variable is set, e.g. via an Apache Action directive.
                      > > > >
                      > > > > First thing you need to do is change the line in php.ini so it is
                      > > > > cgi.force_redir ect = Off
                      > > > >
                      > > > > Then - and this is where I tore my hair out for a while - if you have
                      > > > > your php.ini in the /windows directory, ensure there there isn't also a
                      > > > > default php.ini in the PHP directory as it seems to read that one
                      > > > > first.
                      > > > >
                      > > > > Or, why not just have it in the PHP directory and save a lot of
                      > > > > heartache :o)[/color][/color][/color]

                      Are you running Apache or IIS?

                      Apache's home directory is htdocs (usually in the apache/apache2
                      directory)
                      IIS uses the inetpub directory as stated by others previously.

                      Comment

                      • Jerry Stuckle

                        #12
                        Re: Need help on PHP

                        william.clarke wrote:[color=blue]
                        > teddybear wrote:
                        >[color=green]
                        >>My friend, where are you going? Anybody out there, please help???
                        >>I am stuck...
                        >>
                        >>teddybear wrote:
                        >>[color=darkred]
                        >>>I have another problem now. My browser said "Page Coult Not Be Found".
                        >>>However I have set cgi.force_redir ect = 0 in the PHP.ini inside /PHP
                        >>>directory,
                        >>>And I have put Hello.PHP both in the /wwwroot directory and /PHP
                        >>>directory.
                        >>>Can you please suggest me what is the problem this time?
                        >>>
                        >>>Thank you for help!
                        >>>
                        >>>--Ted
                        >>>
                        >>>teddybear wrote:
                        >>>
                        >>>>I have replied you on the scripts.com forum. Thanks, and I am looking
                        >>>>forward to your reply!
                        >>>>
                        >>>>WhatsPHP wrote:
                        >>>>
                        >>>>>This PHP CGI binary was compiled with force-cgi-redirect enabled. This
                        >>>>>means that a page will only be served up if the REDIRECT_STATUS CGI
                        >>>>>variable is set, e.g. via an Apache Action directive.
                        >>>>>
                        >>>>>First thing you need to do is change the line in php.ini so it is
                        >>>>>cgi.force_ redirect = Off
                        >>>>>
                        >>>>>Then - and this is where I tore my hair out for a while - if you have
                        >>>>>your php.ini in the /windows directory, ensure there there isn't also a
                        >>>>>default php.ini in the PHP directory as it seems to read that one
                        >>>>>first.
                        >>>>>
                        >>>>>Or, why not just have it in the PHP directory and save a lot of
                        >>>>>heartach e :o)[/color][/color]
                        >
                        >
                        > Are you running Apache or IIS?
                        >
                        > Apache's home directory is htdocs (usually in the apache/apache2
                        > directory)
                        > IIS uses the inetpub directory as stated by others previously.
                        >[/color]

                        The DEFAULT home directory for Apache is htdocs. This can be changed in to any
                        directory on the system in the httpd.conf file.

                        Same with IIS - the DEFAULT is inetpub\wwwroot . But can be easily changed.

                        But in either case PHP can be in its own directory. It does not have to be in
                        the website path. And the same with php.ini.

                        --
                        =============== ===
                        Remove the "x" from my email address
                        Jerry Stuckle
                        JDS Computer Training Corp.
                        jstucklex@attgl obal.net
                        =============== ===

                        Comment

                        • teddybear

                          #13
                          Re: Need help on PHP

                          Hi,
                          I run IIS. Can I just email you instead?
                          Thanks for responding to help.
                          --Ted

                          Jerry Stuckle wrote:[color=blue]
                          > william.clarke wrote:[color=green]
                          > > teddybear wrote:
                          > >[color=darkred]
                          > >>My friend, where are you going? Anybody out there, please help???
                          > >>I am stuck...
                          > >>
                          > >>teddybear wrote:
                          > >>
                          > >>>I have another problem now. My browser said "Page Coult Not Be Found".
                          > >>>However I have set cgi.force_redir ect = 0 in the PHP.ini inside /PHP
                          > >>>directory,
                          > >>>And I have put Hello.PHP both in the /wwwroot directory and /PHP
                          > >>>directory.
                          > >>>Can you please suggest me what is the problem this time?
                          > >>>
                          > >>>Thank you for help!
                          > >>>
                          > >>>--Ted
                          > >>>
                          > >>>teddybear wrote:
                          > >>>
                          > >>>>I have replied you on the scripts.com forum. Thanks, and I am looking
                          > >>>>forward to your reply!
                          > >>>>
                          > >>>>WhatsPHP wrote:
                          > >>>>
                          > >>>>>This PHP CGI binary was compiled with force-cgi-redirect enabled. This
                          > >>>>>means that a page will only be served up if the REDIRECT_STATUS CGI
                          > >>>>>variable is set, e.g. via an Apache Action directive.
                          > >>>>>
                          > >>>>>First thing you need to do is change the line in php.ini so it is
                          > >>>>>cgi.force_ redirect = Off
                          > >>>>>
                          > >>>>>Then - and this is where I tore my hair out for a while - if you have
                          > >>>>>your php.ini in the /windows directory, ensure there there isn't also a
                          > >>>>>default php.ini in the PHP directory as it seems to read that one
                          > >>>>>first.
                          > >>>>>
                          > >>>>>Or, why not just have it in the PHP directory and save a lot of
                          > >>>>>heartach e :o)[/color]
                          > >
                          > >
                          > > Are you running Apache or IIS?
                          > >
                          > > Apache's home directory is htdocs (usually in the apache/apache2
                          > > directory)
                          > > IIS uses the inetpub directory as stated by others previously.
                          > >[/color]
                          >
                          > The DEFAULT home directory for Apache is htdocs. This can be changed in to any
                          > directory on the system in the httpd.conf file.
                          >
                          > Same with IIS - the DEFAULT is inetpub\wwwroot . But can be easily changed.
                          >
                          > But in either case PHP can be in its own directory. It does not have to be in
                          > the website path. And the same with php.ini.
                          >
                          > --
                          > =============== ===
                          > Remove the "x" from my email address
                          > Jerry Stuckle
                          > JDS Computer Training Corp.
                          > jstucklex@attgl obal.net
                          > =============== ===[/color]

                          Comment

                          • Jerry Stuckle

                            #14
                            Re: Need help on PHP

                            teddybear wrote:[color=blue]
                            > Hi,
                            > I run IIS. Can I just email you instead?
                            > Thanks for responding to help.
                            > --Ted
                            >
                            >[/color]

                            Thanks for asking, but no, I keep free support on the newsgroups. That way
                            everyone can pitch in with their own comments and others can learn from what's
                            being posted.

                            I used to provide offline support but it ate into too much of my billable time.
                            I have to reserve that for my paying customers.


                            --
                            =============== ===
                            Remove the "x" from my email address
                            Jerry Stuckle
                            JDS Computer Training Corp.
                            jstucklex@attgl obal.net
                            =============== ===

                            Comment

                            • teddybear

                              #15
                              Re: Need help on PHP

                              Hi, my question is above...
                              My browser return error message: "Page Could Not Be Found".
                              Seems I have done everything installing PHP on IIS.
                              I have put my hello.php into \wwwroot directory and \PHP directory
                              I have set the path to c:\PHP
                              I have change cgi.force_redir ect = 0
                              And still I could not figure out what else to fix.

                              Well, thanks for your respond, your time and consideration

                              --Ted

                              Jerry Stuckle wrote:[color=blue]
                              > teddybear wrote:[color=green]
                              > > Hi,
                              > > I run IIS. Can I just email you instead?
                              > > Thanks for responding to help.
                              > > --Ted
                              > >
                              > >[/color]
                              >
                              > Thanks for asking, but no, I keep free support on the newsgroups. That way
                              > everyone can pitch in with their own comments and others can learn from what's
                              > being posted.
                              >
                              > I used to provide offline support but it ate into too much of my billable time.
                              > I have to reserve that for my paying customers.
                              >
                              >
                              > --
                              > =============== ===
                              > Remove the "x" from my email address
                              > Jerry Stuckle
                              > JDS Computer Training Corp.
                              > jstucklex@attgl obal.net
                              > =============== ===[/color]

                              Comment

                              Working...