For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > February 2007 > I just loaded the latest Apache http server for/o Widows XP...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author I just loaded the latest Apache http server for/o Widows XP...
Rob

2007-02-06, 6:58 pm

....and the latest distribution of PHP for same. apache tells me it's
up & running, but I don't know what I need to do to run my PHP
scripts. What do I do?

Carl Pearson

2007-02-07, 6:58 pm

Rob wrote:
> ...and the latest distribution of PHP for same. apache tells me it's
> up & running, but I don't know what I need to do to run my PHP
> scripts. What do I do?
>


For apache to 'know' it's a php file, it has to have a php extension,
i.e., index.php

Putting php statements inside index.html will NOT work.

(Actually, that's not exactly true. apache uses a file's extension to
decide how to parse a particular file. The extension that will get
parsed by the PHP processor is defined in your apache conf, and can be
anything you prefer. Most folks just use .php though...)

Also, you should verify PHP is actually running.

Make a file - test.php, whatever, just make sure it has a 'php'
extension - which has this one line:

<?php phpinfo(); ?>

Put it in your documentroot (if you're not sure where that is, look in
your Apache's httpd.conf for the word 'DocumentRoot') and call it up in
the browser.

You should see a nice purple header with your PHP version, and a bunch
of other info. If you do, PHP is running.

If not, the apache config has probably not been set up. Check for lines
like these in httpd.conf:

#replace "/path/to" with the actual path to these files...
LoadFile "/path/to/php5ts.dll"
LoadModule php5_module "/path/to/php5apache2_2.dll"

<IfModule php5_module>
<Location />
AddType text/html .php .phps
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
</Location>
</IfModule>

Also, apache "likes" the php.ini to be in its own apache bin folder.

Restart Apache, and you should be good to go.
Rob

2007-02-08, 6:58 pm

On Feb 7, 6:46 am, Carl Pearson <jman_spam_trap_....@gmail.com> wrote:
> Rob wrote:
>
> For apache to 'know' it's a php file, it has to have a php extension,
> i.e., index.php
>
> Putting php statements inside index.html will NOT work.
>
> (Actually, that's not exactly true. apache uses a file's extension to
> decide how to parse a particular file. The extension that will get
> parsed by the PHP processor is defined in your apache conf, and can be
> anything you prefer. Most folks just use .php though...)
>
> Also, you should verify PHP is actually running.
>
> Make a file - test.php, whatever, just make sure it has a 'php'
> extension - which has this one line:
>
> <?php phpinfo(); ?>
>
> Put it in your documentroot (if you're not sure where that is, look in
> your Apache's httpd.conf for the word 'DocumentRoot') and call it up in
> the browser.
>
> You should see a nice purple header with your PHP version, and a bunch
> of other info. If you do, PHP is running.
>
> If not, the apache config has probably not been set up. Check for lines
> like these in httpd.conf:
>
> #replace "/path/to" with the actual path to these files...
> LoadFile "/path/to/php5ts.dll"
> LoadModule php5_module "/path/to/php5apache2_2.dll"
>
> <IfModule php5_module>
> <Location />
> AddType text/html .php .phps
> AddHandler application/x-httpd-php .php
> AddHandler application/x-httpd-php-source .phps
> </Location>
> </IfModule>
>
> Also, apache "likes" the php.ini to be in its own apache bin folder.
>
> Restart Apache, and you should be good to go.



I went to the "httpd.conf" file, and added this:

# For PHP 5 do something like this:
LoadModule php5_module "C:\Program Files\PHP\php5apache2_2_4.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:\Program Files\PHP"

and then ran the "<?php phpinfo(); ?>" script. It ran (correctly) in
my browser, but then an error message came up, shutting down apache. I
turned apache back on; the same thing happened again-- but this time,
when I tried to turn it back on, an error message came up, telling me
the operation couldn't be performed (wouldn't run apache). I restarted
my computer; apache wouldn't start again (same error message).

I removed the added lines from the "httpd.conf" file, and restarted
everything. Everything ran fine; but when I re-added the "LoadModule
php5_module..." code, it wouldn't start apache. What's going on? And
what do I do now?

Gleep

2007-02-09, 6:59 pm

On 6 Feb 2007 15:27:36 -0800, "Rob" <rfhurley@yahoo.com> wrote:

>...and the latest distribution of PHP for same. apache tells me it's
>up & running, but I don't know what I need to do to run my PHP
>scripts. What do I do?



Sounds like you might be new at this. But if in fact you are running apache correctly and it's
working with PHP you can easily test it

create a file called test.php
in that file type this
<?php
phpinfo();
?>
save that file to your default location or the root folder for your apache install
usually it's apache/htdocs
start up apache then
open a browser type www.localhost/test.php
you should see a screen with lots of information

If you are working on home network with router, you need to make sure the router (port 80) is
forwarding to the correct IP that is assigned to your machine on your network. You should be able
to identifie your IP with your network settings and be familar with adjusting the configuratino on
your router. If not go to the manufactur documentation or ask someone with lots of experince with
this stuff. It can be very frustrating getting all this sorted when starting out.

Back around 2000 or so I used to struggle for days installing apache/php/mysql manually but just
kept at it... Eventually I found a site called apachefriends they have a very simple
application whenere you can install a complete server with all the trimming in 5 minutes.
look for xampplite in google read up on it, it's very slick
Rob

2007-02-09, 6:59 pm

On Feb 9, 11:26 am, Gleep <G...@Gleep.com> wrote:
> On 6 Feb 2007 15:27:36 -0800, "Rob" <rfhur...@yahoo.com> wrote:
>
>
> Sounds like you might be new at this. But if in fact you are running apache correctly and it's
> working with PHP you can easily test it
>
> create a file called test.php
> in that file type this
> <?php
> phpinfo();
> ?>
> save that file to your default location or the root folder for your apache install
> usually it's apache/htdocs
> start up apache then
> open a browser type www.localhost/test.php
> you should see a screen with lots of information
>
> If you are working on home network with router, you need to make sure the router (port 80) is
> forwarding to the correct IP that is assigned to your machine on your network. You should be able
> to identifie your IP with your network settings and be familar with adjusting the configuratino on
> your router. If not go to the manufactur documentation or ask someone with lots of experince with
> this stuff. It can be very frustrating getting all this sorted when starting out.
>
> Back around 2000 or so I used to struggle for days installing apache/php/mysql manually but just
> kept at it... Eventually I found a site called apachefriends they have a very simple
> application whenere you can install a complete server with all the trimming in 5 minutes.
> look for xampplite in google read up on it, it's very slick


I ran the " <?php phpinfo(); ?> " script and it did bring up the page
with the purple header. THEN the error message(s) came up & shut
down apache. I have a whole slew of reports, all written in a language
my pet cyborg understands, but he just communicates with clicks &
beeps, so I don't understand HIM either...

But I would be happy to post (or send you) some of the error dialog-
box info, log files or whatever would help clear this up for me.
btw... I'm running apache & PHP on my laptop. opefully the Hairy
Thunderer will not banish me to Sheol for this...

Rob

Rob

2007-02-09, 6:59 pm

On Feb 9, 11:26 am, Gleep <G...@Gleep.com> wrote:
> On 6 Feb 2007 15:27:36 -0800, "Rob" <rfhur...@yahoo.com> wrote:
>
>
> Sounds like you might be new at this. But if in fact you are running apache correctly and it's
> working with PHP you can easily test it
>
> create a file called test.php
> in that file type this
> <?php
> phpinfo();
> ?>
> save that file to your default location or the root folder for your apache install
> usually it's apache/htdocs
> start up apache then
> open a browser type www.localhost/test.php
> you should see a screen with lots of information
>
> If you are working on home network with router, you need to make sure the router (port 80) is
> forwarding to the correct IP that is assigned to your machine on your network. You should be able
> to identifie your IP with your network settings and be familar with adjusting the configuratino on
> your router. If not go to the manufactur documentation or ask someone with lots of experince with
> this stuff. It can be very frustrating getting all this sorted when starting out.
>
> Back around 2000 or so I used to struggle for days installing apache/php/mysql manually but just
> kept at it... Eventually I found a site called apachefriends they have a very simple
> application whenere you can install a complete server with all the trimming in 5 minutes.
> look for xampplite in google read up on it, it's very slick


btw... I'm checking out "apachefriends". thanks again
R

Rob

2007-02-09, 6:59 pm

On Feb 9, 11:26 am, Gleep <G...@Gleep.com> wrote:
> On 6 Feb 2007 15:27:36 -0800, "Rob" <rfhur...@yahoo.com> wrote:
>
>
> Sounds like you might be new at this. But if in fact you are running apache correctly and it's
> working with PHP you can easily test it
>
> create a file called test.php
> in that file type this
> <?php
> phpinfo();
> ?>
> save that file to your default location or the root folder for your apache install
> usually it's apache/htdocs
> start up apache then
> open a browser type www.localhost/test.php
> you should see a screen with lots of information
>
> If you are working on home network with router, you need to make sure the router (port 80) is
> forwarding to the correct IP that is assigned to your machine on your network. You should be able
> to identifie your IP with your network settings and be familar with adjusting the configuratino on
> your router. If not go to the manufactur documentation or ask someone with lots of experince with
> this stuff. It can be very frustrating getting all this sorted when starting out.
>
> Back around 2000 or so I used to struggle for days installing apache/php/mysql manually but just
> kept at it... Eventually I found a site called apachefriends they have a very simple
> application whenere you can install a complete server with all the trimming in 5 minutes.
> look for xampplite in google read up on it, it's very slick


Gleep!

Thanks!

I went to apache Friends & downloaded xampp! (cue Dr. Frankenstein
voice:)

"It's aLI-IVE!!!"

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com