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 | | | | 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\wwwroot | | Newbie | | Join Date: Jun 2006
Posts: 6
| | | re: Need help on PHP
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??
| | | | 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\wwwroot[/color]
Thanks for reminding me that I have to put my hello.php in the
C:\Inetpub\wwwroot 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 | | | | 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_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
heartache :o) | | Newbie | | Join Date: Jun 2006
Posts: 6
| | | re: Need help on PHP
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_redirect = 0?
Here is the section regarding cgi.force_redirect from PHP.ini inside /PHP folder:
----
; cgi.force_redirect 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_redirect = 1
------
And here is the one inside my PHP.ini in the /Windows folder:
------
; cgi.force_redirect 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_redirect = 1
cgi.force_redirect = 0
-----
The one in the /windows directory says cgi.force_redirect = 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
| | | | 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_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
> heartache :o)[/color] | | Newbie | | Join Date: Jun 2006
Posts: 6
| | | re: Need help on PHP
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_redirect = 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!
| | | | re: Need help on PHP
I have another problem now. My browser said "Page Coult Not Be Found".
However I have set cgi.force_redirect = 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_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
> > heartache :o)[/color][/color] | | | | 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_redirect = 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_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
> > > heartache :o)[/color][/color][/color] | | | | 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_redirect = 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_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
> > > > 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. | | | | 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_redirect = 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
>>>>>heartache :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@attglobal.net
================== | | | | 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_redirect = 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
> >>>>>heartache :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@attglobal.net
> ==================[/color] | | | | 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@attglobal.net
================== | | | | 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_redirect = 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@attglobal.net
> ==================[/color] | | | | re: Need help on PHP
teddybear wrote:[color=blue]
> 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_redirect = 0
> And still I could not figure out what else to fix.
>
> Well, thanks for your respond, your time and consideration
>
> --Ted
>[/color]
Your files go into the wwwroot hierarchy. C:\PHP is for the php code - not your
web pages.
If you have that in your wwwroot directory and get the not found message when
accessing http://www.example.com/hello.php, you have a setup problem. I suspect
something isn't being loaded properly.
First of all I would highly recommend you install PHP as an isapi filter. It's
not hard - I did it last week in just a little while.
If you're still getting the error, make sure you're using a basic php.ini file -
no extensions, etc. Also, by default the system will try to load the file from
your %SYSTEM_ROOT% directory, so get a copy in there.
If it still fails, please post exactly what you've done to date.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
================== | | | | re: Need help on PHP
Hi Jerry,
I will try to load ISAPI I will try to follow what you said here and
will come back post the result later.
--Ted
Jerry Stuckle wrote:[color=blue]
> teddybear wrote:[color=green]
> > 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_redirect = 0
> > And still I could not figure out what else to fix.
> >
> > Well, thanks for your respond, your time and consideration
> >
> > --Ted
> >[/color]
>
> Your files go into the wwwroot hierarchy. C:\PHP is for the php code - not your
> web pages.
>
> If you have that in your wwwroot directory and get the not found message when
> accessing http://www.example.com/hello.php, you have a setup problem. I suspect
> something isn't being loaded properly.
>
> First of all I would highly recommend you install PHP as an isapi filter. It's
> not hard - I did it last week in just a little while.
>
> If you're still getting the error, make sure you're using a basic php.ini file -
> no extensions, etc. Also, by default the system will try to load the file from
> your %SYSTEM_ROOT% directory, so get a copy in there.
>
> If it still fails, please post exactly what you've done to date.
>
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================[/color] | | | | re: Need help on PHP
Hi Jerry,
Just to give you update on my case...
I have solved the problem of "Could Not Find The Page"...
I have tested it with hello.htm. The server IIS is responding. Now the
only thing is
to configure why it does not parse hello.php... it could be the system
recognize it as
hello.php.txt (as it is a text document I created with Text Editor)
Thanks again,
--Ted
teddybear wrote: Quote:
Hi Jerry,
I will try to load ISAPI I will try to follow what you said here and
will come back post the result later.
--Ted
>
Jerry Stuckle wrote: Quote:
teddybear wrote: Quote:
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_redirect = 0
And still I could not figure out what else to fix.
>
Well, thanks for your respond, your time and consideration
>
--Ted
>
Your files go into the wwwroot hierarchy. C:\PHP is for the php code - not your
web pages.
If you have that in your wwwroot directory and get the not found message when
accessing http://www.example.com/hello.php, you have a setup problem. I suspect
something isn't being loaded properly.
First of all I would highly recommend you install PHP as an isapi filter. It's
not hard - I did it last week in just a little while.
If you're still getting the error, make sure you're using a basic php.ini file -
no extensions, etc. Also, by default the system will try to load the file from
your %SYSTEM_ROOT% directory, so get a copy in there.
If it still fails, please post exactly what you've done to date.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
==================
| | | | re: Need help on PHP
teddybear wrote: Quote:
Hi Jerry,
Just to give you update on my case...
I have solved the problem of "Could Not Find The Page"...
I have tested it with hello.htm. The server IIS is responding. Now the
only thing is
to configure why it does not parse hello.php... it could be the system
recognize it as
hello.php.txt (as it is a text document I created with Text Editor)
Thanks again,
--Ted
>
No, hello.php.txt will not work. It must have a .php extension.
Apache uses the extension to determine how to route processing. In your Apache
configuration you told it (or at least should have) to parse .php files with the
PHP library. So your files much have .php extensions, not .php.txt or anything
else.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
================== |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,449 network members.
|