SitePoint Sponsor

User Tag List

View Poll Results: Is this Tutorial of any value?

Voters
19. You may not vote on this poll
  • Extremely

    8 42.11%
  • Somewhat

    7 36.84%
  • I'm completely confused now buddy!

    2 10.53%
  • You suck

    2 10.53%
Results 1 to 7 of 7
  1. #1
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb TUTORIAL : Installing Apache 1.3.x & PHP 4.2 under Windows XP as a service

    INTRODUCTION

    If you are installing Apache for the first time skip this and go straight to the TUTORIAL section to lessen confusion.

    First I'm writing this for others on the web that are experiencing problmes with their existing Apache install for Win32 or newbies that are tired and frustrated with all the hassle of installing Apache, MySQL, PHP to run under Windows XP. I'm going to explain some problems that I was experiencing with my existing Apache install so that someone on the web with the same problems might hit on some of the keywords in this post. Especially trying to get Apache to run as a service. Been there done that!!

    I'm breaking this up into 2 sections, the first outlines the problems I had with my existing install. The second section, below, is a step by step approach to installing Apache 1.3.x with MySQL and PHP 4.2 Note : I tried installing Apache 2.0 with PHP 4.2 and get the cannot load module php4apache.dll. I had the same problem with Apache 1.3.x and PHP 4.2 and found a way to fix it, I could not with Apache 2.0


    THE PROBLEM

    I've recently been using ActiveStates perl running under Windows XP Corporate with PHP 1.x installed. ActiveState comes with Apache pre-configured for the i386 platform which makes getting up and running with Apache fast and easy.

    The other day, while working on my client's site, I noticed my PHP scripts started running whacky. When I refreshed the page the script seemend to loop over and over and most of the time the browser would report a 404 error that the page could not be found. I spent hours trying to figure out what was wrong with my script to no avail. Then I simply wrote a one line script with a phpinfo() call. Still the same problem. I re-installed my ActiveState Apache/perl package and nothing changed. Then I had the bright idea to re-install Apache (as a service), and while I was at it go ahead and install PHP 4.2.

    Urg, I ran into several problem. After installing Apache 1.3.x as a service and PHP 4.2 I was getting the cannot load module php4apache.dll error. When I typed in http://localhost/ it would not load the index.php file. Values passed with a script in the address bar such as index.php?act=go&id=2 would not work. So, I had to manually configure Apache and fix the php4apache.dll problem. After all this work I figured I would create a tutorial that should help folks get up and running. I've included my httpd.conf file and php.ini files along with the links to download Apache and PHP 4.2.

    -----
    TIP: If you already have Apache 1.3x and PHP installed and are trying to run it as a service. You need to copy the php4ts.dll file to C:\WINDOWS\SYSTEM not C:\WINDOWS\SYSTEM32 if everything else is set up properly, you followed the setup instructions in the Apache and PHP manuals you should be good to go. This should stop the cannot load module php4apache.dll error message.
    -----

    TUTORIAL - INSTALLING APACHE AS A SERVICE TO RUN UNDER WINDOWS XP.

    1) To save download time we are going to use the Apache MSI installer file without source.

    2) Click here to download Apache 1.3.x for Win32 and save it to your desktop : http://www.apache.org/dist/httpd/bin...x86-no_src.msi

    3) Click here to download PHP 4.2 for Win32 and save it to your desktop as well : http://www.php.net/do_download.php?d....2.0-Win32.zip

    4) Go to your Desktop and run the apache_1.3.2*.msi file that you downloaded in step 2. Be sure to install apache to the default directory \program files\apache group\apache. For the network domain etc, I used localhost.

    5) Make a directory called c:\php

    6) Double click the php-4.2*.zip file on your desktop that you downloaded in step 3. Extract these files to c:\php

    7) Go to my computer and change directories to C:\php\php4.2.0-win32 folder and select everything, then click on cut.

    8) Go back to the c:\php folder and paste the files. It should move all the php folders and files to c:\php
    After the files are moved to c:\php you can delete the c:\php4.2.0-win32 folder.

    9) Go to your dos prompt and change to c:\php

    10) copy the php4ts.dll file to c:\windows\system DO NOT COPY TO c:\windows\system32

    Note, without the php4ts.dll file in c:\windows\system Apache will give you that cannot load module php4apache.dll error message when started as a service!

    11) Download this file and save it to c:\program files\apache group\apache\conf note, in IE right click on this link and select "Save Target As" : http://www.washcomall.com/holmescreek/tutor/httpd.conf

    12) Download this file and save it to c:\windows note, in IE right click on this link and select "Save Target As" :

    http://www.washcomall.com/holmescreek/tutor/php.ini

    13) Create a file called index.php in c:\program files\apache group\apache\htdocs and add the following lines :

    <?php phpinfo(); ?>

    14) Installation of Apache 1.3.x and PHP 4.2 is complete.

    15) Start Apache : click on Start->All Programs->Apache HTTPD Server -> Control Apache - > Start Apache

    16) Open IE or Netscape and type in : http://localhost/ you should see the PHPINFO() screen or rather it will run the index.php file you created in step 13.

    FINAL NOTES :

    For reference these are the modifications that I made to my httpd.conf file and the php.ini files in the appropriate sections. If you download and use the httpd.conf file or php.ini files that I have provided above you do not need to make any of these changes :

    httpd.conf :

    Added : LoadModule php4_module c:/php/sapi/php4apache.dll

    Added : AddModule mod_php4.c

    Added : AddType application/x-httpd-php .php

    In the section titled DirectoryIndex I added:

    <IfModule mod_php4.c>
    DirectoryIndex index.php
    </IfModule>



    php.ini :

    1) I set the following to allow for passing variables such as index.php?act=1234

    register_globals = On

    2) Typically I store my include files in a directory above htdocs called phplib. For instance, I put my script with database user name and password rather than in htdocs where someone could view the file.

    ; Windows: "\path1;\path2"
    include_path = ".;c:\program files\apache group\apache\phplib"

    Note : I previously did following in my scripts to include a file :

    <?php
    include("/program files/apache group/apache/phplib/db.php");
    ?>

    Now I simply use :

    include("db.php");

    By setting the include_path above php automatically knows to check for include files in the/program files/apache group/apache/phplib directory.


    IN CONCLUSION

    I know that this is a lengthy post. However, I wanted to target both the novice doing their first Apache/Php install and those folks who are in the process of installation having trouble loading Apache as a service that properly loads php.

    Any feedback or questions are welcome!

    holmescreek@holmescreek.com
    http://www.holmescreek.com/
    Last edited by holmescreek; May 10, 2002 at 12:17.

  2. #2
    SitePoint Evangelist cyngon's Avatar
    Join Date
    Aug 2001
    Location
    Livonia, MI, USA
    Posts
    513
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I also found this tutorial online which covers installing Apache 2.0.39, PHP 4.2.1, and MySQL 4.0.1 Alpha:

    http://www.vbulletin.org/forum/showt...threadid=39482

    I'm going to stay away from the Alpha version of MySQL, but I plan on switching to the new version of Apache tonight.

  3. #3
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It think it could be reduced to three words.

    "Install PHP Home."

  4. #4
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It think it could be reduced to three words.
    That isn't a very nice thing to say, even though it's true.

    holmescreek probably spent a fair amount of time to write this tutorial, you know...

    Vincent

  5. #5
    SitePoint Zealot
    Join Date
    Oct 2001
    Location
    Montreal, Canada
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by HarryF
    It think it could be reduced to three words.

    "Install PHP Home."
    The bad thing with package like this? You stay idiot with how the whole thing work together because you didn't install it. What I have to say to newbies: install php, mysql and apache yourself and get your hands dirty.

    (nothing againts you HarryF)

    Mike
    Last edited by ALSLG; Aug 28, 2002 at 22:52.
    Dis donc, qu'est-ce qu'il dit ce mec? Hein? Je comprends rien...

  6. #6
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by ALSLG


    The bad thing with package like this? You stay idiot with how the whole thing work together because you didn't install it. What I have to say to newbies: install php, mysql and apache yourself and get your hands dirty.

    (nothing againts you HarryF)

    Mike
    I like to install these manually rather than let installers install for me. I want to learn how to do everything server and php, so I second yours. (no offense to HarryF too!!)

  7. #7
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No offence meant to the tutorial at all. Wasn't meant to cause trouble. I agree using an installer hides things you need to know eventually. Thing is I think for beginners interesting primarily in PHP and MySQL, we should be recommending packages like PHPHome and PHP Dev. When the time comes to learn about what's really going on, this article is perfect.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •