Configuring PHP to use Apache (Windows XP Pro) - Module

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

User avatar
K82
Forum Newbie
Posts: 14
Joined: Mon Nov 20, 2006 5:27 pm
Location: Mid-West

Configuring PHP to use Apache (Windows XP Pro) - Module

Post by K82 »

Evening-

I just downloaded PHP, MySQL and Apache (latest versions of each). I'm using a book "PHP Fast and East Web Development" to learn PHP5. So far I've had nothing but trouble with the book.. i.e. not helping much. But I think its because the versions I am trying to install are different then the books versions.

I have MySQL and Apache installed and as far as I can tell they are both working. I can access MySQL with MySQL Administrator, and the Apache service is running near the system clock.

The book wants me to test the installation of PHP/Apache and informs me to make the following change in httpd.conf. The line I added is in bold.

Code: Select all

#
# Dynamic Shared Object (DSO) Support
#

... 
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
...
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule ssl_module modules/mod_ssl.so
[b]LoadModule php5_module C:/php// php5apache2.dll[/b]

# 'Main' server configuration
I removed most of the lines to make it easier to read.

When I use Apache Service Monitor to start Apache, it starts up fine. I stop the service, add that line, and then try to start the service and it fails to start. I removed the line and then it started again.

The book is telling me to add that line to install the Apache Module version of PHP. Can someone tell me why this line is failing, am I doing it incorrectly? I've tried with several combinations but I can't get it to start with that line.

BTW: Bold isnt working, so the line I'm adding is just tagged

Thanks.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

bbcode tags won't ever work in the highlighted segments. That's how we want it.

What versions of each, specifically?
User avatar
K82
Forum Newbie
Posts: 14
Joined: Mon Nov 20, 2006 5:27 pm
Location: Mid-West

Post by K82 »

PHP: 5.2.0
MySQL: 5.0.27
Apache: 2.2.3
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Apache 2.2 has a specific module built just for it under PHP 5.2. php5apache2.dll is for Apache 2.0

PHP 5.2 has php5apache2_2.dll.
User avatar
K82
Forum Newbie
Posts: 14
Joined: Mon Nov 20, 2006 5:27 pm
Location: Mid-West

Post by K82 »

Ok, I replaced the line with the new line and I still get the same error...

Code: Select all

LoadModule php5_module C:/php// php5apache2_2.dll
Error:
The requested operation has failed!!!
When I open the status monitor and click start.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Is that DLL there? Why do you have two slashes? Is there actually a space after that last slash? Have you tried placing the path in double quotes?
User avatar
K82
Forum Newbie
Posts: 14
Joined: Mon Nov 20, 2006 5:27 pm
Location: Mid-West

Post by K82 »

Well that's just wonderfull.

I got it working now. Yes the file was there I checked that already. There was a space and double forward slashes. The book's example is saying that's how its supposed to be. That is the exact quote from the book with two slashes and a space and no quotes.

I changed the line to this

Code: Select all

LoadModule php5_module "C:/php/php5apache2_2.dll"
Now the service starts. Like I said so far this book has been crap. I think I'm going to take it back and get a different one.

Everything looks like its running now, but I can tell you its not. I created a file to test the PHP is running and loaded it in my browser "http://127.0.0.1/phpinfo.php" and instead of getting the PHP Info page, I get the code in the browser,
<? phpinfo(); ?>
This book sure isn't helping much. :roll:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Short tags are off by default (as they should be) in PHP 5.

Code: Select all

<?php
phpinfo();
?>
should give you some results.
User avatar
K82
Forum Newbie
Posts: 14
Joined: Mon Nov 20, 2006 5:27 pm
Location: Mid-West

Post by K82 »

Nah,

I still get the exact same thing with the code showing in the page. But its still showing the old code not the new one you just gave me (yes I saved the file). I wouldn't doubt if something is configured wrong since I used the book to configure it, and its yet to prove a worthy purchase.

Not sure what to do I guess.

Thanks for the help.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Did you add the "addtype" directive(s) to your httpd.conf?

Your caching may be getting in the way of seeing the newest pages, make sure to clear it.
User avatar
K82
Forum Newbie
Posts: 14
Joined: Mon Nov 20, 2006 5:27 pm
Location: Mid-West

Post by K82 »

I added this line in the section with the rest.

Code: Select all

AddType application/x-httpd.php .phtml .php
Cleared the cache and now when I visit the page its prompting me to download the PHP file instead of displaying it. I assume something is not configured. I've got a lot of expierence with Microsoft languages, but none in PHP, sorry I'm having so much trouble. Just decided to learn this. I wanted to get away from MS languages...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Proper syntax would be

Code: Select all

AddType application/x-httpd-php .php .phtml
User avatar
K82
Forum Newbie
Posts: 14
Joined: Mon Nov 20, 2006 5:27 pm
Location: Mid-West

Post by K82 »

Made the change its still prompting me to download the PHP file, instead of displaying it. Sorry, I guess its not going to work for me. Thought it would be easier to get this up and going.
User avatar
K82
Forum Newbie
Posts: 14
Joined: Mon Nov 20, 2006 5:27 pm
Location: Mid-West

Post by K82 »

Well, feyd it just started working after I restared the computer. I don't know why.

Do you think that syntax issue would have caused it? I changed that line.

Also I had the file php5ts.dll in the System directory as the book told me to. I decided to move it to System32 directory instead. Once I restarted its working fine. Not sure if it was your syntax fix or because I moved the library to that new location.

Anyway I want to know what I was doing wrong so before I go any farther I am going to put things back and try to recreate the issue, and do the fixes one at a time until I find the one that was the mistake.

I have a gut feeling it was the library file being in the wrong directory though, not sure.

Thanks very much for all the help! Sorry for the double post.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

PHP's DLLs don't need to be in any Windows directories. Your php.ini may not be set up correctly (there are multiple paths that are specified in it.) It's hard to say without knowing how the book recommended to butcher things.
Post Reply