Results 1 to 6 of 6

Thread: Installing PHP 5.3 and Apache HTTP Server on Windows 7

  1. #1
    Moderator
    Join Date
    Jan 05
    Location
    Sydney
    Posts
    13,615

    Installing PHP 5.3 and Apache HTTP Server on Windows 7

    If you just want to install Apache and aren't bothered about PHP, read Installing Apache HTTP Server on Windows 7.


    Installing PHP

    At the time of writing, the latest stable version is 5.3.6.

    1. Download PHP from this page:
      http://windows.php.net/download/
      Get the latest thread-safe VC9 binary in zip archive format.


    2. Extract the archive into a suitable directory — usually C:\php\.

    3. Navigate into this directory and rename the file php.ini-development to php.ini.
      This will give you a configuration which is suitable for development work. (For example, all error messages and warnings will be shown.)


    4. Open a terminal window. Change into the directory where you extracted the files and run php -i. You should see rather a lot of output.

      Name:  php01.png
Views: 18072
Size:  43.5 KB



    Installing Apache HTTP Server

    At the time of writing, the latest stable version is 2.2.19.

    1. Download Apache from this page:
      http://www.apachelounge.com/download/
      Get the first link under the heading "Apache 2.2 win32 binary". It's another zip archive.


    2. Extract the archive. The default path is C:\apache2\.
      (If you want to extract it elsewhere, look for that path in the httpd.conf file and change it to the path which you used.)


    3. Using your terminal window, change into the bin directory under the Apache directory, and run httpd -k install to install Apache as a service.

      Name:  apache03.png
Views: 18034
Size:  39.6 KB

      Ignore the message about the domain name, if it appears.

    4. Run httpd -k start to start the server.

      Name:  apache04.png
Views: 18044
Size:  42.3 KB

      Now navigate to http://localhost/ to see if it worked.



      The file you are seeing is index.html, under htdocs in the Apache directory.




    Configuring PHP as an Apache Module

    1. Edit the file conf\httpd.conf under the Apache directory.

      Add the following to the bottom of the file:

      Code:
      LoadModule php5_module "c:/php/php5apache2_2.dll"
      <IfModule php5_module>
      	AddType application/x-httpd-php .php
      	PHPIniDir c:/php/
      	DirectoryIndex index.php index.html
      </IfModule>
      If you installed PHP into a different path, change the paths above.

    2. In the htdocs directory, create a file called test.php with the following contents:
      Code:
      <?php phpinfo(); ?>
    3. Restart Apache (httpd -k restart) to effect the changes we've made.

    4. Now navigate to http://localhost/test.php in your web browser.
      You should see a page like this:


      Name:  php02.png
Views: 17991
Size:  79.2 KB


    Great success!


    Installing MySQL Server 5.5 on Windows 7
    Last edited by penagate; Jun 2nd, 2011 at 04:36 AM.

  2. #2
    Member
    Join Date
    Jul 12
    Posts
    52

    Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7

    great job..

  3. #3
    New Member
    Join Date
    Oct 12
    Posts
    1

    Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7

    need help installing Apache

    The php install was successful however when running the httpd -k install , an error occurs saying

    <OS 5>Access is denied. : FAiled to open the WinNT service manager

    Please help regarding the same

    Regards,

    AsG

  4. #4
    Moderator
    Join Date
    Jan 05
    Location
    Sydney
    Posts
    13,615

    Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7

    Make sure the terminal you use to run the command has administrative privileges. (When logged in as a user with admin rights, find 'Command Prompt' in the Start menu, right-click on it, and choose 'Run as administrator'.)

  5. #5
    New Member sadeqzadeh's Avatar
    Join Date
    Feb 13
    Location
    Helsinki, Finland
    Posts
    1

    Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7

    Thank you very much. It was the only well illustrated guide on Internet. I had serious trouble in installing both Apache and PHP.
    One important point that mentioning it will be useful is that if you 've downloaded PHP version 5.4 (all its sub-versions), in the stage of modifying config file (httpd.conf), instead of writing this line:
    LoadModule php5_module "c:/php/php5apache2_2.dll"
    you should wirte this one:
    LoadModule php5_module "c:/php/php5apache2_4.dll"
    The change is in the name of file, Although the old DLL file still exists in the directory, it isn't functional and if you use if, you will get an error concerning the lack of existence of the file.
    Another point is that if you 're going to log in with the administrator user account for the first time (to prevent having problem with privileges), remember to start Apache windows service in services console. It is not started by default, even if its status is auto. You should start it manually for the first time.

    Cheers.

  6. #6
    Moderator
    Join Date
    Jan 05
    Location
    Sydney
    Posts
    13,615

    Re: Installing PHP 5.3 and Apache HTTP Server on Windows 7

    Good tips. I'll update the guide soon.

Posting Permissions

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