473,376 Members | 1,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,376 software developers and data experts.

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

Jun 22 '06 #1
18 7759

teddybear wrote:
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).


Your root directory is c:\Inetpub\wwwroot

Jun 22 '06 #2
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??
Jun 22 '06 #3
WhatsPHP wrote:
teddybear wrote:
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).


Your root directory is c:\Inetpub\wwwroot


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

Jun 22 '06 #4
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)

Jun 22 '06 #5
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
Jun 22 '06 #6
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)


Jun 22 '06 #7
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!
Jun 22 '06 #8
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)


Jun 22 '06 #9
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)


Jun 23 '06 #10

teddybear wrote:
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)


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.

Jun 25 '06 #11
william.clarke wrote:
teddybear wrote:
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)

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.


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.
js*******@attglobal.net
==================
Jun 26 '06 #12
Hi,
I run IIS. Can I just email you instead?
Thanks for responding to help.
--Ted

Jerry Stuckle wrote:
william.clarke wrote:
teddybear wrote:
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)

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.


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.
js*******@attglobal.net
==================


Jun 26 '06 #13
teddybear wrote:
Hi,
I run IIS. Can I just email you instead?
Thanks for responding to help.
--Ted


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.
js*******@attglobal.net
==================
Jun 26 '06 #14
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:
teddybear wrote:
Hi,
I run IIS. Can I just email you instead?
Thanks for responding to help.
--Ted


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.
js*******@attglobal.net
==================


Jun 27 '06 #15
teddybear wrote:
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.
js*******@attglobal.net
==================
Jun 27 '06 #16
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:
teddybear wrote:
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.
js*******@attglobal.net
==================


Jun 27 '06 #17
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:
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:
teddybear wrote:
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.
js*******@attglobal.net
==================
Jul 2 '06 #18
teddybear wrote:
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.
js*******@attglobal.net
==================
Jul 2 '06 #19

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sofia | last post by:
My name is Sofia and I have for many years been running a personals site, together with my partner, on a non-profit basis. The site is currently not running due to us emigrating, but during its...
7
by: Mike Kamermans | last post by:
I hope someone can help me, because what I'm going through at the moment trying to edit XML documents is enough to make me want to never edit XML again. I'm looking for an XML editor that has a...
8
by: JustSomeGuy | last post by:
I need to write an new class derived from the list class. This class stores data in the list to the disk if an object that is added to the list is over 1K in size. What methods of the std stl...
2
by: Michael R. Pierotti | last post by:
Dim reg As New Regex("^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$") Dim m As Match = reg.Match(txtIPAddress.Text) If m.Success Then 'No need to do anything here Else MessageBox.Show("You need to enter a...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
8
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? --...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
15
by: Jess | last post by:
Hello, Sometimes declarations are all what we need when we define/declare classes (or functions?), but sometimes we need definitions. I learned that if we define a class (B) that has an object...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.