Installing PHP 5.3 and Apache HTTP Server on Windows 7-VBForums
Results 1 to 15 of 15

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

  1. #1

    Thread Starter
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,630

    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: 44234
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: 44151
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: 43870
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: 43897
Size:  79.2 KB


    Great success!


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

  2. #2
    Member
    Join Date
    Jul 2012
    Posts
    52

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

    great job..

  3. #3
    New Member
    Join Date
    Oct 2012
    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

    Thread Starter
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,630

    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 2013
    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

    Thread Starter
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,630

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

    Good tips. I'll update the guide soon.

  7. #7
    New Member
    Join Date
    Aug 2013
    Posts
    3

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

    Nice, detailed description but I have a couple of suggestions:

    - Installing binaries on the root directory may be normal in Linux but in Windows 7 is not good practice. These should be installed in c:/Program Files. However, to do this in Windows 7 you should first do everything suggested above, including editing the config files (httpd.conf and php.ini), in temporary folders, say c:/Users/[name]/Documents/Apache and (ditto root)/PHP and then copy these two folders to Program Files. Windows 7 is very protective of files and folders under Program Files and it is a royal pain trying to edit files once they are copied to Program Files. NB You will of course have to change some directives within these config files.

    - There are two changes I'd make to Apache's httpd.conf. First, change the Document Root to something like C:/Users/[your name]/Documents/Websites. In other words, store your web documents...where else but under Documents? Again, this is normal Windows practice but it also makes the files easier to access and to backup.
    - If you are just using the webserver to test PHP scripts locally before sending them off to your host, I suggest setting the "listen" directive to localhost:80, so that you don't inadvertently start up a webserver that listens to the world outside. Unlikely because most people are behind firewalls these days but just an additional precaution.

    Yes, I agree that all the advice out there keeps telling people to install on the root and put documents in c:/Apache/docs but that's because most advice seems to come from Linux users. I've been doing it this way for 10 years and have never had a problem with this set up.

  8. #8
    New Member
    Join Date
    Sep 2013
    Posts
    1

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

    I have followed the steps to install PHP but when I write "php i" on command prompt it gives error " The program can't start because MSVCR110.dll is missing from your computer. Try reinstalling the program to fix this problem"

  9. #9
    New Member
    Join Date
    Aug 2013
    Posts
    3

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

    Quote Originally Posted by smnaqi View Post
    I have followed the steps to install PHP but when I write "php i" on command prompt it gives error " The program can't start because MSVCR110.dll is missing from your computer. Try reinstalling the program to fix this problem"
    This thread is 2 years old. The new installs for the most recent Apache version require VC10 (not the VC9 mentioned above). Download them from here: http://www.microsoft.com/en-us/downl....aspx?id=30679

  10. #10

    Thread Starter
    Moderator
    Join Date
    Jan 2005
    Location
    Sydney
    Posts
    13,630

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

    I haven't used PHP on Windows for a long time (since this thread was written, in fact) but I believe PHP 5.5 is built against VC11 — for which, in addition to the runtime linked above, you will probably need a VC11 Apache binary, which you can get here:
    www.apachelounge.com/download/

  11. #11
    New Member
    Join Date
    Aug 2013
    Posts
    3

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

    Ah yes, I stand corrected on the VC for the latest versions--and I should know as I have installed them myself recently. Fortunately, the link is the correct one and will download VC11...although you too may also be confused by the fact that 2012 installs VC11

  12. #12
    Registered User
    Join Date
    Apr 2014
    Posts
    3

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

    Very-2 use full link - Thanks

  13. #13
    Registered User
    Join Date
    Sep 2014
    Posts
    3

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

    Hi! thank you very much for this very good illustrated guide.After install PHP and Apache HTTP Server,i fail to start the server by run httpd -k start in the terminal window.i have this error:

    httpd: Syntax error on line 37 of C:/Program Files/WebDev/Apache/Apache24/conf/hHpd.conf: ServerRoot must be a valid directory.

    please help

    regards

    Baba

  14. #14
    Registered User
    Join Date
    Sep 2014
    Posts
    3

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

    hi i saw my error and after that i run httpd -k start in the terminal window and gave autorisation to Windows fire fall.after that i navigated to http://localhost/ but i have this message: This webpage is not available
    please help

    regards

    Baba

  15. #15
    Registered User
    Join Date
    Sep 2014
    Posts
    3

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

    here is the message in the terminal window:
    c:\Apache24\bin>httpd -k start
    AH00558: httpd: Could not reliably determine the server's fully qualified domain
    name, using fe80::213a:9216:28da:fc12. Set the 'ServerName' directive globally
    to suppress this message

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.