By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,175 Members | 1,689 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,175 IT Pros & Developers. It's quick & easy.

Apache 2.0.54, Windows 2k, and php5.0.5 - do the work together

P: n/a
I'm a php newbie. I have installed apache 2.0.54 and php 5.0.5 on my
win2k box. However, it does not appear the php is working properly. I
base this on the following code(which I got from a book):

<html>
<head>
<title>Listing Server Variables</title>
</head>
<body>
<h2>PHP and HTML</h2>
<P>Server Variables</P>
<?php
$envs = array ("HTTP_REFERER", "HTTP_USER_AGENT", "REMOTE_ADDR",
"REMOTE_HOST", "QUERY_STRING", "PATH_INFO");
foreach ($envs as $env)
print "$env: $GLOBALS[$env]<br>";
?>
</body>
</html>

All I get when I access via: http://localhost/phptest1.html is:

PHP and HTML

Server Variables
"; ?>

So, my first question is "Do these versions of software play well
together?" If so, where do I look first? I have added the following
lines to httpd.conf:

LoadModule php5_module "C:/php5/php5apache2.dll"
PHPIniDir "C:/php5"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

I took the php.ini.recommended, changed the name to php.ini, then
changed doc_root as follows:

doc_root = "C:\Program Files\Apache Group\Apache2\htdocs"

If these versions will play together, then what have I overlooked in
the install? Any help, comments, suggestions, are welcome.

Bill W

Sep 11 '05 #1
Share this Question
Share on Google+
15 Replies


P: n/a
May be a stupid question, but did you restart apache after installing
PHP? And did you put php.ini in C:\windows or winnt or whatever your
windows path is?

Sep 11 '05 #2

P: n/a
On 10 Sep 2005 21:32:19 -0700, IW****@gmail.com wrote:
May be a stupid question, but did you restart apache after installing
PHP? And did you put php.ini in C:\windows or winnt or whatever your
windows path is?


And what pray are you replying to?

Learn to quote!
Sep 11 '05 #3

P: n/a
On 10 Sep 2005 20:33:37 -0700, we*******@charter.net wrote:
All I get when I access via: http://localhost/phptest1.html is:

PHP and HTML

Server Variables
"; ?>


That's probably because you've saved the file as .HTM or .HTML, save it as
php and it will work fine.
Sep 11 '05 #4

P: n/a
changed to .php and accessed via http://localhost/phptest1.php and now
I get the following:

PHP and HTML

Server Variables
HTTP_REFERER:
HTTP_USER_AGENT:
REMOTE_ADDR:
REMOTE_HOST:
QUERY_STRING:
PATH_INFO:

BUT shouldn't I be seeing some values here? Do I have php/apache
configured properly (see original post)?

Bill W

Sep 11 '05 #5

P: n/a
On 11 Sep 2005 10:26:55 -0700, we*******@charter.net wrote:
changed to .php and accessed via http://localhost/phptest1.php and now
I get the following:

PHP and HTML

Server Variables
HTTP_REFERER:
HTTP_USER_AGENT:
REMOTE_ADDR:
REMOTE_HOST:
QUERY_STRING:
PATH_INFO:

BUT shouldn't I be seeing some values here? Do I have php/apache
configured properly (see original post)?

Bill W


Your getting the same as me! and I'm using the same configuration.

Have you tried the basic ..

<?php

phpinfo();

?>

This should list everything you need, if it doesn't then you may have
problems, but if the previous script threw up the same as my working
machine, then I would guess that yours is working fine.

If you want info on the global variables on your system the run this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta name="Generator" content="TextPad 4.7">
<meta name="Author" content="Barry Ambrose">
<meta name="Keywords" content="?">
<meta name="Description" content="?">
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Global Variables</title>
<style type="text/css">
body{background-color: #fff}
font-size: .8em;
font-family: arial serif;
</style>
</head>
<body>
<table width="100%" border="1">
<tr><td colspan="2"><h1>Displaying Predefined Variables</h1></td>
</tr>
<tr><td width="40%" valign="top">Globals - $GLOBALS</td>
<td width="60%"><pre>
<?php
echo "<pre>";
print_r($GLOBALS);
echo "</pre>";
?>
</td>
</tr>
<tr><td width="40%" valign="top">Server - $_SERVER</td>
<td width="60%"><pre>
<?php
echo "<pre>";
print_r($_SERVER);
echo "</pre>";
?>
</td>
</tr>
<tr><td width="40%" valign="top">
Get - $_GET</td>
<td width="60%"><pre>
<?php
echo "<pre>";
print_r($_GET);
echo "</pre>";
?>
</td>
</tr>
<tr><td width="40%" valign="top">Post - $_POST</td>
<td width="60%"><pre>
<?php
echo "<pre>";
print_r($_POST);
echo "</pre>";
?>
</td>
</tr>
<tr><td width="40%" valign="top">Cookie - $_COOKIE</td>
<td width="60%"><pre>
<?php
echo "<pre>";
print_r ($_COOKIE) ;
echo "</pre>";
?>
</td>
</tr>
<tr><td width="40%" valign="top">Files - $_FILES</td>
<td width="60%"><pre>
<?php
echo "<pre>";
print_r ($_FILES);
echo "</pre>";
?>
</td>
</tr>
<tr><td width="40%" valign="top">Environment - $_ENV</td>
<td width="60%>
<?php
echo "<pre>";
print_r($_ENV);
echo "</pre>";
?>
</td>
</tr>
<tr><td width="40%" valign="top">Request - $_REQUEST</td>
<td width="60%"><pre>
<?php
echo "<pre>";
print_r($_REQUEST);
echo "</pre>";
?>
</td>
</tr>
<tr><td width="40%" valign="top">Session - $_SESSION</td>
<td width="60%"><pre>
<?php
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
?>
</td>
</tr>
</table>
</body>
</html>

But this will only give you much the same info as the first script.
Sep 11 '05 #6

P: n/a
On 11 Sep 2005 10:26:55 -0700, we*******@charter.net wrote:
changed to .php and accessed via http://localhost/phptest1.php and now
I get the following:

PHP and HTML

Server Variables
HTTP_REFERER:
HTTP_USER_AGENT:
REMOTE_ADDR:
REMOTE_HOST:
QUERY_STRING:
PATH_INFO:

BUT shouldn't I be seeing some values here? Do I have php/apache
configured properly (see original post)?

Bill W


Of course if you upload to a webserver and run it you will get different
results.
Sep 11 '05 #7

P: n/a
On 10 Sep 2005 20:33:37 -0700, "we*******@charter.net" <we*******@charter.net>
wrote:
I'm a php newbie. I have installed apache 2.0.54 and php 5.0.5 on my
win2k box. However, it does not appear the php is working properly. I
base this on the following code(which I got from a book):
The book is apparently quite old.
<?php
$envs = array ("HTTP_REFERER", "HTTP_USER_AGENT", "REMOTE_ADDR",
"REMOTE_HOST", "QUERY_STRING", "PATH_INFO");
foreach ($envs as $env)
print "$env: $GLOBALS[$env]<br>";


None of the above are set as globals in the default and recommended
configuration of PHP since PHP 4.2.0.

You (correctly) have register_globals disabled. See the manual for more
details.

The content you're after will be available from the $_SERVER array.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Sep 11 '05 #8

P: n/a
In article <0m********************************@4ax.com>,
Andy Hassall <an**@andyh.co.uk> wrote:
On 10 Sep 2005 20:33:37 -0700, "we*******@charter.net" <we*******@charter.net>
wrote:
I'm a php newbie. I have installed apache 2.0.54 and php 5.0.5 on my
win2k box. However, it does not appear the php is working properly. I
base this on the following code(which I got from a book):


The book is apparently quite old.
<?php
$envs = array ("HTTP_REFERER", "HTTP_USER_AGENT", "REMOTE_ADDR",
"REMOTE_HOST", "QUERY_STRING", "PATH_INFO");
foreach ($envs as $env)
print "$env: $GLOBALS[$env]<br>";


None of the above are set as globals in the default and recommended
configuration of PHP since PHP 4.2.0.

You (correctly) have register_globals disabled. See the manual for more
details.

The content you're after will be available from the $_SERVER array.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool


Make a fiel, call it test.php.

cut 'n paste this into it

__________________

<?php

phpinfo();

?>

___________________

load the fiel from your server root with your browser.

If it gives you a bunch of info then your setup is working.

If not, then it is not.
Happy Trails
Claude
Sep 11 '05 #9

P: n/a
the phpinfo() did the trick....I get all sorts of info so I guess it is
working. Yes, the book is old. "Teach yourself PHP in 24hrs",
copyright 2002. Got it for less than a dollar at a garage sale....

Ok....so it looks like I do indeed have everything configured
correctly. Thanks for the info.

Bill W

Sep 12 '05 #10

P: n/a
In article <11*********************@g44g2000cwa.googlegroups. com>,
we*******@charter.net <we*******@charter.net> wrote:
the phpinfo() did the trick....I get all sorts of info so I guess it is
working. Yes, the book is old. "Teach yourself PHP in 24hrs",
copyright 2002. Got it for less than a dollar at a garage sale....

Ok....so it looks like I do indeed have everything configured
correctly. Thanks for the info.

Bill W


Cool

There is much more up-to-date info on the net...

Claude
Sep 12 '05 #11

P: n/a
I have Win2k, Apache, and PHP and the localhost is set up for IIS at
port 80. I had to set up Apache on port 8080.

No IIS on the machine?
On 10 Sep 2005 20:33:37 -0700, "we*******@charter.net"
<we*******@charter.net> wrote:
I'm a php newbie. I have installed apache 2.0.54 and php 5.0.5 on my
win2k box. However, it does not appear the php is working properly. I
base this on the following code(which I got from a book):
All I get when I access via: http://localhost/phptest1.html is:


Sep 12 '05 #12

P: n/a

Obvious wrote:
On 10 Sep 2005 21:32:19 -0700, IW****@gmail.com wrote:
May be a stupid question, but did you restart apache after installing
PHP? And did you put php.ini in C:\windows or winnt or whatever your
windows path is?


And what pray are you replying to?

Learn to quote!


The topic creator? I though it was "obvious" (pun completly intended).
I'm on Google Groups, so maybe it's not as apparent to you guys or
something.

iw****@gmail.com

Sep 12 '05 #13

P: n/a
<IW****@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

Obvious wrote:
On 10 Sep 2005 21:32:19 -0700, IW****@gmail.com wrote:
May be a stupid question, but did you restart apache after installing
PHP? And did you put php.ini in C:\windows or winnt or whatever your
windows path is?


And what pray are you replying to?

Learn to quote!


The topic creator? I though it was "obvious" (pun completly intended).
I'm on Google Groups, so maybe it's not as apparent to you guys or
something.


Learn to use the quoting features of Google Groups! It is customary to quote
enough of the post to which you are responding for readers to be able to
understand the context of your response.

--
Bill Segraves
Sep 13 '05 #14

P: n/a
I don't understand. Somebody asked a question. I posted the first
reply. Who else could I be responding to? Which part is confusing?

Bill Segraves wrote:
<IW****@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

Obvious wrote:
On 10 Sep 2005 21:32:19 -0700, IW****@gmail.com wrote:

> May be a stupid question, but did you restart apache after installing
> PHP? And did you put php.ini in C:\windows or winnt or whatever your
> windows path is?

And what pray are you replying to?

Learn to quote!


The topic creator? I though it was "obvious" (pun completly intended).
I'm on Google Groups, so maybe it's not as apparent to you guys or
something.


Learn to use the quoting features of Google Groups! It is customary to quote
enough of the post to which you are responding for readers to be able to
understand the context of your response.

--
Bill Segraves


Sep 13 '05 #15

P: n/a
<IW****@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
I don't understand.
It appears to be so. ;-)
Somebody asked a question. I posted the first
reply. Who else could I be responding to?
You were responding to thousands of readers of the Usenet newsgroup
comp.lang.php, with utter disregard for Usenet ettiquette. You have no right
to waste the time of all of these good people by disregarding the rules of
behavior.
Which part is confusing?

The part where you don't yet understand the customs of Usenet. We hope you
learn to conform before you are killfiled by many Usenet contributors who
could be valuable resources for you.

Also, you should not top-post, a.k.a. jeopardy post. Long-standing Usenet
custom is to intersperse your comments with the key points to which you are
responding, e.g.,
Q1. skugfh
A1. sDKf
Q2. ;lkhjaga


A2.

Finally, while you seem to have picked up on the suggestion that you use
your Google Groups setup to quote correctly, you missed the mark because you
top-posted, showing disrespect for everyone that reads your post.

Cheers.
--
Bill Segraves

<extraneous content snipped>
Sep 13 '05 #16

This discussion thread is closed

Replies have been disabled for this discussion.