Another Newbie - Error Installing PHP 5.2 with Apache 1.3

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

attraxion
Forum Newbie
Posts: 7
Joined: Mon Jan 01, 2007 11:58 am

Another Newbie - Error Installing PHP 5.2 with Apache 1.3

Post by attraxion »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi All,

I'm a big newbie with all this, and I'm trying to install PHP 5.2 under Apache 1.3, my OS is Win XP. I first installed Apache and it is working fine. Please go through the following steps / file fragments and tell me where I'm going wrong in installing PHP.

1- I unzipped the PHP files to C:/Programming/PHP, and also copied the dll's to the system32 directory.

2- I copied the php.ini-dist file to the windows directory (renamed as php.ini) and added the following to it -

Code: Select all

doc_root = "C:/Programming/Apache Group/Apache/htdocs"
extension_dir = "C:/Programming/PHP/ext"
Also I turned on extensions for various things.

3- Then I added the following lines to the httpd.conf file -

Code: Select all

LoadModule php5_module "C:/Programming/PHP/php5apache.dll"
Addmodule mod_php5.c
AddType application/x-httpd-php .php
Action application/x-httpd-php "php/php.exe"
Then when I made a test.php in the Apache htdocs directory, it gives me a 400 Bad Request. If I comment out the "Action application/x-httpd-php "php/php.exe" line from the httpd file, it gives me the option of downloading the file (that means it is finding the file, I guess. It doesn't know what to do with it.)

But over here on DevNetwork when I was looking at similar queries by others, I did not see any action line added in their httpd files. Is that because they're using Apache 2?

Please tell me where I'm going wrong, I'm quite frustrated by now. Thanks a lot in advance.

Best,
Attraxion.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Re: Another Newbie - Error Installing PHP 5.2 with Apache 1.

Post by Oren »

attraxion wrote:But over here on DevNetwork when I was looking at similar queries by others, I did not see any action line added in their httpd files. Is that because they're using Apache 2?
I use Apache 2 and this is pretty much all I added to the httpd.conf file:

Code: Select all

LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
Don't forget to restart Apache after you make changes and only then check if it works or not :wink:
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

attraxion wrote:But over here on DevNetwork when I was looking at similar queries by others, I did not see any action line added in their httpd files. Is that because they're using Apache 2?
php is installed either as module or as cgi. LoadModule and Action at the same time in the same scope would be mixing both, that's not possible the way you did it.
Take a look at http://www.php.net/manual/en/install.wi ... pache1.php and http://www.apachefriends.org/en/xampp.html
attraxion
Forum Newbie
Posts: 7
Joined: Mon Jan 01, 2007 11:58 am

Post by attraxion »

volka wrote:php is installed either as module or as cgi. LoadModule and Action at the same time in the same scope would be mixing both, that's not possible the way you did it.
Okay, but the thing is when I remove the Action line then my browser starts downloading the test.php file rather than do anything with it. What could be the reason for that?

Best,
Attraxion.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

I wuold Suggest You
1. First Uninstall Your Existing Apache Installetion
2. Download XAMP
3. Install It
It Would Install Apache + php + MySQL +......... By itshelf
It Would be Much more easier
attraxion
Forum Newbie
Posts: 7
Joined: Mon Jan 01, 2007 11:58 am

Post by attraxion »

Yes, that would be good and easy I know.. but I want to give this installation a shot (call it a mad desire on doing things by myself :), makes me feel happy ) Please continue to help me guys, I'll go in for xamp only if I cannot resolve this in 1-2 days.

Best,
Attraxion.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

attraxion wrote:Okay, but the thing is when I remove the Action line then my browser starts downloading the test.php file rather than do anything with it. What could be the reason for that?
a misconfiguration ;)
Is there something like ClearModuleList in your httpd.conf?
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

Well Thats A Very Good Idea
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

search Your httpd.conf file Where the "LoadModule" (s) are ( some of Them Are in # Prefixed )
Add Just Bellow Of The Last LoadModule the following

Code: Select all

LoadModule php5_module c:\Your_php_directory\php5\php5apache2.dll
Next Search AddType Section there is something like
AddType application/x-tar .tgz
AddType image/x-icon .ico

Add The Following Type Just Bellow it

Code: Select all

AddType application/x-httpd-php .php .phtml .html .other_extions_Separated_By_Spaces_If_You_want_to_Be_Parsed_As_php

Code: Select all

Move php.ini-recomended file to the C:\Windows\ and Rename It to php.ini
Move php5ts.dll To C:\windows\system\
Restart Apache Server
attraxion
Forum Newbie
Posts: 7
Joined: Mon Jan 01, 2007 11:58 am

Post by attraxion »

Hi Volka, yes there is a ClearModuleList in my httpd.conf file.

Hi Neel, I followed all your steps (most of the things were already there, as my first post said). And curiously enough, I am now getting '404 Not Found' error instead of the Bad Request earlier.

What could be the error?

Best,
Attraxion.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

attraxion wrote:Hi Volka, yes there is a ClearModuleList in my httpd.conf file.
The AddModule directive must be after that ClearModuleList (since ClearModuleList removes the module). The other AddModule lines are at the correct place in the default httpd.conf and therefore the step-by-step howto neel_basu gave you did the trick. (btw: apache2 has no ClearModuleList directive)

DocumentRoot in your httpd.conf points to the directory you can access via http://localhost/
Place a file test.html in that directory and request it, http://localhost/test.html
If that works place a file test.php in that directory and call http://localhost/test.php
attraxion
Forum Newbie
Posts: 7
Joined: Mon Jan 01, 2007 11:58 am

Post by attraxion »

Hi Volka, please notice that Neel's directions do not have an Addmodule command, only LoadModule and Addtype. Indeed, when apart from these I insert an AddModule command it says "already loaded module" in the Apache test configuration application.

The other steps you mentioned work fine -

document root is C:/Programming/Apache Group/Apache/htdocs
test.html in this directory is working
test.php is not working

:cry: fully frustrated by now,
Attraxion.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Take xampp.
If you must do it on your own start from scratch. Do not try to repair it. De-install apache, remove the whole directory and start anew. Follow http://www.php.net/manual/en/install.wi ... pache1.php exactly, step-by-step.
Last edited by volka on Tue Jan 02, 2007 9:59 am, edited 1 time in total.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

look I Do This Whenever I Set up My Home Server And Thats A Very Fresh Installation

I Just Install Apache2
You Can Download Apache2 From http://www.eng.lsu.edu/mirrors/apache/h ... no_ssl.msi
Then I Install php 5 ( Extract the zip file And Do Copy Paste )
You Can Download from php 5 from http://in.php.net/get/php-5.2.0-Win32.zip/from/a/mirror

And Then I Enter The conf Directory
Edit The httpd.conf file
Then Do The Above mentioned

And That Works Fine

I think You Have Changed So many Things in your httpd.conf file
Download That Files And Then Do A Fresh Installetion

I Belief You Would Succedd

EDIT
{
But First Remove Your Previously Installed Aplications
Uninstall Previously Installed Apache And php
}
attraxion
Forum Newbie
Posts: 7
Joined: Mon Jan 01, 2007 11:58 am

Post by attraxion »

I downloaded xampp... so much for my mad idealism :x

Its working fine. I decided it would be wiser to spend time on the language rather than on the install only. Thanks a lot (especially Volka and Neel) for all your replies and help, I will continue to bother you when I begin to make my own website :D These forums rock !!

Best,
Attraxion.
Post Reply