search
top

How install Apache 2.4 PHP 5.4 and MySQL 5.5.21 on Windows 7

Recently decided to install a working Apache 2.4 / PHP 5.4.9 and MySQL 5.5 running locally on my Windows 7 laptop for web design, not using XAMPP or WAMP installation methods. Which are great but this round I wanted to match my Linux server.

Apache 2.4 Install

First download Apache 2.4 from http://www.apachelounge.com/download/ (httpd-2.4.1-win32.zip) Apache 2.4.1
with IPv6 apr-1.4.6 apr-util-1.4.1 apr-iconv-1.2.1 pcre-8.21 lua-5.1 libxml2-2.7.8 openssl-1.0.0g zlib-1.2.6. This release is supported by the PHP 5.4 install from windows.php.net for Apache 2.4.

Extract the zip and copy it to the root of C:\. This will be C:\Apache24 when it is all done.

Update 01-17-2013: The version of the php5apache2_4.dll must match the version of PHP you are installing. The link that was reference before has been changed and moved to http://www.apachelounge.com/download/additional/ for versions 5.4.9 and earlier. As of PHP 5.4.10 the module is now included in the Windows build.

PHP 5.4.9 and Earlier

Download PHP 5.4.9 VC9 x86 Thread Safe from http://windows.php.net/download/releases/archives/php-5.4.9-Win32-VC9-x86.zip . Extract and rename folder to php and move to C:\
Also, download php5apache2_4.dll-php-5.4-win32.zip (http://www.apachelounge.com/download/win32/modules-2.4/php5apache2_4.dll-php-5.4-win32.zip)
Runs with PHP 5.4 Thread Safe (TS), and only with Apache 2.4 Win32 VC9 or VC10.

PHP 5.4.10 and higher

Download PHP 5.4 VC9 x86 Thread Safe from http://windows.php.net/download/ . Extract and rename folder to php and move to C:\.

Update 01-17-2013: This next edit seems to cause issues with php5apache2_4.dll not found errors, so I have added two options for PHP 5.4.9 and earlier and PHP 5.4.10 and above. I want to thank all those who have brought this to my attention and I hope this helps out. Also, due to the addition of the php5apache2_4.dll being included in PHP 5.4.10 and above builds you no longer need to download the module separately.

PHP 5.4.9 and earlier Option 1

Extract php5apache2_4.dll-php-5.4-win32.zip and copy php5apache2_4.dll to the c:\php\ directory. This is needed to allow Apache to use PHP.  Edit Apache’s config file, c:\Apache24\conf\httpd.conf and add the following lines to the bottom of the file.

LoadModule php5_module "c:/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"

While we are at it we can add index.php to Apache’s list just incase we want to have a starting page as php.

Find Directory index and add index.php

DirectoryIndex index.html index.php

Next we need to input a value  for ServerName variable. You will have to un-comment it. Save the changes to the config file. Next move to the Register Apache Service step.

PHP 5.4.9 and earlier Option 2

Extract php5apache2_4.dll-php-5.4-win32.zip and copy php5apache2_4.dll to the c:\php\ext directory. This is needed to allow Apache to use PHP.  Edit Apache’s config file, c:\Apache24\conf\httpd.conf and add the following lines to the bottom of the file.

LoadModule php5_module "c:/php/ext/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"

While we are at it we can add index.php to Apache’s list just incase we want to have a starting page as php.

Find Directory index and add index.php

DirectoryIndex index.html index.php

Next we need to input a value  for ServerName variable. You will have to un-comment it. Save the changes to the config file. Next move to the Register Apache Service step.

PHP 5.4.10 and newer

Edit Apache’s config file, c:\Apache24\conf\httpd.conf and add the following lines to the bottom of the file.

LoadModule php5_module "c:/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"

While we are at it we can add index.php to Apache’s list just incase we want to have a starting page as php.

Find Directory index and add index.php

DirectoryIndex index.html index.php

Next we need to input a value  for ServerName variable. You will have to un-comment it. Save the changes to the config file. Next move to the Register Apache Service step.

Register Apache Service

Now let’s register Apache as a service. Open a command prompt and type.

c:\apache24\bin\httpd -k install

If do not want Apache starting automatically at start-up/reboot:

GUI Way

  • START | RUN
  • Type in services.msc, hit Enter or click OK
  • Locate Apache2 service and double-click (or right-click for Properties)
  • Find the caption Startup type: (in the middle of the dialog box), use the pull-down and select Manual
  • Click OK

Command line

C:\> sc config Apache2.4 start= demand

Add

c:\Apache24; c:\Apache24\bin

to PATH in Environment variables. PATH ENVIRONMENT (System Properties | Advanced | Environment Variables | System variables | Path).
Example:
;c:\php;c:\apache24;c:\apache24\bin;

Now lets check Apache settings by issuing the command, c:\Apache24\bin\httpd -S

PHP Edits

Now we have to do a few edits to the php.ini file to tell it to load support for mysql and the location for the extensions. Since there is not a already set php.ini file we need to rename one of the two examples to php.ini.

Rename c:\php\php.ini-development to php.ini

Now let’s edit php.ini
Uncomment extension directory.

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "ext"

Uncomment mysql modules
extension=php_mysql.dll
extension=php_mysqli.dll

Save the changes and open a command prompt. Check to make sure it shows loaded modules.

C:\> php -m

So now we have Apache running and configured to use php. Lets create a file called info.php, save it and see if Apache parses the info correctly to display the results.

Open Notepad or your favorite Windows editor and type and save the following.

 <?php
phpinfo();
?>

Open your browser and type, localhost/info.php for the location and you should receive alot of information about PHP.

MySQL
Download and install mysql-5.5.21-win64.msi. Change installation directory to C:\MySQL\MySQL Server 5.5 instead of Program files as there could be permissions issues. Once the installation is completed you can let the configuration wizard run and setup the database server. The defaults will work just fine, but remember what you set the password to for root.

PHPMyAdmin
PHPMyAdmin is a very nice tool to use for administering your MySQL installation.
Download and install phpmyadmin-3.4.10.1-english.zip.
Extract the file and move to c:\apache24\htdocs. Rename directory to phpmyadmin.
Create a config directory under phpmyadmin. Open a browser and type localhost/phpmyadmin/setup/index.php to complete the installation.

At this point you should have a working Apache / PHP / MySQL installation running and ready for you to start developing !!!

187 Responses to “How install Apache 2.4 PHP 5.4 and MySQL 5.5.21 on Windows 7”

  1. spaderz says:

    You misstated, php5apache2_4.dll should be extracted to c:\php\

    • newlife007 says:

      Actually I typoed, thanks for catching that. The reason I put the dll in c:\php\ext is because I enabled the mysql dll’s and they are in c:\php\ext. You could leave it in c:\php if that is your preference. The key is that the Apache config has the correct location.

      • Nash says:

        Thanks When I originally necmomted I clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks!

      • Horvath says:

        Thank you I was very pleased to find this web-site.I wtaend to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post .

    • Bastian says:

      Why do you think I’m wrong? Just because it has fliead on your system doesn’t make me wrong. I test things carefully before putting them on my website or in my books, and I have been running PHP 5.2.0 with Apache 2.2.3 successfully for several months.I have no idea what you have done wrong, but suggest that you start again and use the . Before using it, you need to clean up your system by uninstalling Apache and removing the conf folder before reinstalling. Also remove PHP from the Windows path, and make sure that you don’t have a copy of php.ini in the WINDOWS folder.

  2. Dzyu says:

    I can’t find the archive with php5apache2_4.dll as it isn’t available at the link you provided.

    I’m gonna leave out the parts with that .dll and see if that works…

    • spaderz says:

      php5apache2_4.dll is right there on the download page. You’ll need it
      http://www.apachelounge.com/download/

      • Mahmoud says:

        Thank u David, I’ve been solved the lbropem. I have to use the Windows Installer for PHP 5.2.0, I just leave the Apache 2.2.3 and reinstall PHP. But I don’t understand, ’cause I had (previously) Apache 1.5.x or 2.2.0 (i can’t remember well!) and PHP 5.2.0 and I don’t use the Windows Installer for PHP, just extract the files of PHP and configure my Apache and it’s done, but now not, anyway, thank u so much for the help, and I sorry (dumb, I don’t check it the Windows Installer, anyway!!)

      • Imaa says:

        Having a hellish time with Apache 2.2.3 and PHP 5.2I can load ertnyehivg on my machine, have tried with both the info from Dreamweaver 8 and PHP making the changes to the dll file for apache2_2. I have taken ertnyehivg off and put them on several times but can not get the PHP file to read from the localhost. ( when I call the PHP info file it loads up into dreamweaver instead of opening HELP!)

    • Jean says:

      Yes, the Windows version of PHP 5.2.0 has srppout for all three series of Apache: 1.3, 2.0, and 2.2. The difference lies in the DLL file used by PHP to communicate with Apache.Apache 1.3 uses php5apache.dll.Apache 2.0 uses php5apache2.dll.Apache 2.2 uses php5apache2_2.dll. I mean, I have Apache 2.2.3 & PHP 5.2.0 and i’ve configured Apache and changed the line LoadModule php5module C:/PHP_HOME/php5apache2_2.dll, and still have nothing, just the message (in the Apache Monitor) The requested operation has failed! . I don’t know what I’m doing wrong, someone can help me please??? Leave here my e-mail:

      • newlife007 says:

        Jean, Have you made sure to add the other configuration lines in httpd.conf? This is what I have working on my Apache 2.2.22/PHP 5.4 installation.

        LoadModule php5_module “c:/php/php5apache2_2.dll”
        AddHandler application/x-httpd-php .php

        # configure the path to php.ini
        PHPIniDir “C:/php”

    • Yanni says:

      David-I have cleaned both Apache2.23 and PHP5.2 off my ssetym several times. I have reloaded everthing using the new windows installer. Checked and double checked every line of code that I have put into my conf file APACHE starts on the machine, but when I try my test.php file ( the one that is supposted to give me back the PHP page) all’s I get is it oading up in Dreamweaver and not opening. I don’t have any idea where to go to problemsolve this issue .and want to work with your book.thanks .

    • Squishy says:

      Heck of a job there, it abostulely helps me out.

    • Pandu says:

      This has made my day. I wish all psotings were this good.

    • Keith says:

      I thought it was not there either. The link in the article goes to the PHP download site, not the apache lounge download site.

      • newlife007 says:

        That is correct, PHP download is from the PHP site and Apache is downloaded from Apache Lounge Site. The php5apache2_4.dll file is contained in the download from PHP site.

  3. Kejjden says:

    Dzyu, the file can also be found on Apache Lounge’s download page;
    http://www.apachelounge.com/download/

    • Erwin says:

      If you read my original taricle and reply carefully, you will see that I always refer to the Windows version of PHP 5.2.0. php-5.2.0.tar.bz2 contains the uncompiled PHP source code. If you are installing PHP on Windows, you need to download the Windows binaries for PHP 5.2.0. There are two versions: a zip file, and the Windows installer. Instructions for using the zip file are in my books. Instructions for using the Windows installer are in .

  4. Nail Yener says:

    Thanks for the article. Although I installed Apache+PHP+MySQL a couple of times and although I’ve written a similar tutorial like this, I got stuck the last time I tried installing the latest versions.

    • newlife007 says:

      Thanks for the comment. I ran into a few hiccups when I tried the install for me to do web development on Windows 7. I plan to post more how to’s as I configure other pieces fr Apache and Tomcat on Windows.

  5. Pushkar says:

    I pasted the php5apache2_4.dll file into the specified directory.

    The last few lines of my httpd.conf file looks like this

    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin

    LoadModule php5_module “c:/php/ext/php5apache2_4.dll”
    AddHandler application/x-httpd-php .php

    # configure the path to php.ini
    PHPIniDir “C:/php”

    after I install the apache service and I enter the command httpd -k install the following message is displayed

    “The Apache2.4 service is successfully installed.
    Testing httpd.conf….
    Errors reported here must be corrected before the service can be started.
    httpd: Syntax error on line 515 of C:/Apache24/conf/httpd.conf: Cannot load C:/php/ext/php5apache2_4.dll into server: The specified module could not be found.”

    Can you tell me how to resolve this error. Thanks!

    • newlife007 says:

      Did you make the changes to the c:\php\php.ini file and remove the comment off the directory “ext” location? Find the line in the PNP configuration ini (php.ini” and make sure this line is un-commented.

      extension_dir = “ext”

      Save the file and open a command prompt and type php -m and it should come back without errors.

      • Pushkar says:

        Hi! thank you for your reply. Yes, I have made the changes to the php.ini file. I am not interested in installing the database so I just un-commented the extension_dir line. However, when I type in php -m in the command prompt it throws an error saying php is not a recognized command. Do I need to reboot or set some environment variables? Thanks!

        • newlife007 says:

          Add c:\php to the path environment (System Properties | Advanced | Environment Variables | System variables | Path).

          Example:
          ;c:\php;c:\apache24;c:\apache24\bin;

          That should tell it where to find the file. You may have to reboot to get it to set.

  6. Gee says:

    imho LAMPP > XAMPP > WAMPPand you can just drag and drop static files (that don’t need to be icpmoled up front) into eclipse (or an eclipse project to create symbolic links etc) from the http folder instead of useless tying your http folder (the web server root) to your workspace location (which could often be changed from time to timebest wishes,Jochen

  7. Auth says:

    I still got Server Error 500 After activating domule mod_rewrite and change AllowOverride to became All, But after changing AllowOverride AuthConfig to All on file httpd-xampp.conf in directory extra, everything is ok!. tq

  8. Thanks for the article. Although I installed Apache+PHP+MySQL a couple of times and I have followed steps as you told.thanks for share this info with us. Great post!!

  9. Keith says:

    This may be a dumb question, but where do I save the info.php file so it runs as a page in localhost? I am not sure if it should go directly in the c:\ directory or in the c:\apache24 folder, or somewhere else. Please help. Thanks.

  10. alia says:

    Thank you for saving my life. i forgot to do these steps

    LoadModule php5_module “c:/php/ext/php5apache2_4.dll”
    AddHandler application/x-httpd-php .php

    # configure the path to php.ini
    PHPIniDir “C:/php”

    thank God for your post. its really helpfull!

  11. jordi says:

    I recive this error when i try to get phpinfo() from the browser.

    403 Forbbiden. You don’t have permission to access /phpinfo.php on this server.

    I’ve changed the Servername to localhost:80

    • newlife007 says:

      If it is in c:\apache24\htdocs there shouldn’t be an issue with access. Make sure the folder has read & execute rights for Users if it is a different folder.

      • jordi says:

        I’m using c:\apache24\htdocs\ and it has correct rights. I’ve solved the problem by modifying like:

        Options All
        Order deny,allow
        Allow from all
        AllowOverride all
        Require all granted

        I don’t know if this way it’s correct, i’ve seen it on another forum.

        • newlife007 says:

          I forgot to add those to the doc. This is what I have in my httpd.conf file

          Options FollowSymLinks ExecCGI
          AllowOverride None
          Order deny,allow
          Deny from all

          Thanks for bringing that to my attention.

  12. hendrix says:

    hello I have a question, when I put in the address bar localhost / info.php to see the php information does not come out this information but I get the code i wrote in the text editor like this:

    What will be the problem?

    • newlife007 says:

      Usuaully when the code itself is displaying there is a issue with the code being incorrect or it is possible the php module is not loaded and or the information is incorrect in the httpd.conf. I would go back over the settings in the httpd.conf file and look at info.php. Also, after you make changes to httpd.conf you need to make sure Apache gets restarted.

      • Emory Suchan says:

        This is a comment to a 7 month old post but Ive just had a similar problem with php running on apache on Windows recently

        if the php is not your own, checkin in the .php that the <? has the php

        You can inform the interpreter that you want it to execute your commands by adding a pair of these: standard tags "”; short tags “”;

        ive noticed times where just <? would fail and just dump raw code to the browser making sure its <?php seemed to fix the problem i had
        good luck

  13. Herz says:

    In the sentence …

    “Also, download php5apache2_4.dll-php-5.4-win32.zip”

    … the embedded link is wrong. Try it yourself and you will see.
    Thank you for posting this information. Helped me a great deal. :)

    • newlife007 says:

      The original was correct at one time but has changed. I corrected the link, thanks for keeping me honest. Glad the post helped.

  14. Herz says:

    … and the file in my first post is password protected!

    FAIL

  15. I’m getting the error “Could not determine the server’s fully qualified domain name. What should I do? I’m using Windows 7 Professional

    • newlife007 says:

      You must edit the c:\apache24\conf\httpd.conf file and put in a FQDN for ServerName, example ServerName tardis.newlife007.com. You can also put the systems ip address. If this is running on your LAN you can just make it up, if for a company you will use a URL they can supply for you.

  16. Dimitar says:

    I am getting this error:

    C:\Apache24\ bin>httpd.exe
    httpd.exe: Syntax error on line 179 of C:/Apache24/conf/httpd.conf: Cannot load
    C:/php/ext/php5apache2_4.dll into server: %1 is not a valid Win32 application.

    Any ideas?

    • newlife007 says:

      Sure do,
      Make sure you copied php5apache2_4.dll to the c:\php\ext directory and you downloaded and extracted. If that is ok then there must be something it doesn’t like in line 179 of c:\Apache24\conf\httpd.conf. What does line 179 and the surrounding lines look like in your file?

  17. Dimitar says:

    Solved!
    In my case it was 64 bit version of Apache with 32 bit version of PHP. Downloaded PHP 64 (http://www.mediafire.com/file/onpvka3h1gymwa6/php-5.4.3-Win32-VC9-x64.zip), now it works like a charm. Btw, php5apache2_4.dll was included in php zip archive. As for the rest, I was just following this article.

    Thanks!

  18. I says:

    extension_dir = “ext” – don’t work

    extension_dir = “C:/php/ext” – OK

    • newlife007 says:

      extension_dir = “ext” works for me with Apache 2.2 and 2.4. If extension_dir = “c:/php/ext” works for you that’s great. PHP assumes you are in c:/php so it makes me think another setting like maybe your environment variable PATH needs to have c:/php added to it on your system.

  19. Albert Christopher Daniot says:

    i am having these error on command prompt after i input “C:\> php -m”. It says that, c is not recognized as an internal or external command . . .. How can i fix this? please help

    • newlife007 says:

      You need to add the path to c:\php in your environment path statement. I mention that in the post, if you have added it then probably need a reboot for the system to see it. Your system doesn’t know where php lives. In the meantime you can type c:\php\php -m to give it the full path to where it lives.

  20. Albert Christopher Daniot says:

    Thank you so much. now i get it. How bout this localhost/info.php, i cant access to browser? why? im still a beginner here. thanks for the help

    • newlife007 says:

      Looks like my post dropped out the code for the info.php. Use your favorite text editor and save
      < ?php
      phpinfo();
      $>

      as info.php to c:\Apache24\htdocs then open the browser. Sorry about the post it looks like wordpress messed up the code.

  21. Albert Christopher Daniot says:

    Thanks!
    How about this instruction:
    “Open your browser and type, localhost/info.php for the location and you should receive alot of information about PHP”

    what browser does it mean? thanks once again

  22. Albert Christopher Daniot says:

    when i input c:\Apache24\bin\httpd -S in command prompt, it will tell me “the specified module could not be found”. how can i fix this? please help

    • Albert Christopher Daniot says:

      i already done php -m and it displays a lot of modules, yet the php5..dll still could not be found.

      • newlife007 says:

        The php module missing tells me you need to check c:\Apache24\conf\httpd.conf.

        Extract php5apache2_4.dll-php-5.4-win32.zip and copy php5apache2_4.dll to the c:\php\ext directory. This is needed to allow Apache to use PHP. Edit Apache’s config file, c:\Apache24\conf\httpd.conf and add the following lines to the bottom of the file.

        LoadModule php5_module “c:/php/ext/php5apache2_4.dll”
        AddHandler application/x-httpd-php .php

        # configure the path to php.ini
        PHPIniDir “C:/php”

        Also check this piece

        Rename c:\php\php.ini-development to php.ini

        Now let’s edit php.ini
        Uncomment extension directory

        ; Directory in which the loadable extensions (modules) reside.
        ; http://php.net/extension-dir
        ; extension_dir = “./”
        ; On windows:
        extension_dir = “ext”

        Uncomment mysql modules
        extension=php_mysql.dll
        extension=php_mysqli.dll

        I think your error for httpd -S may stem from a configuration piece incorrect.

        • Albert Christopher Daniot says:

          i already tried it but again, it shows me the same error.

          • newlife007 says:

            copy php5apache2_4.dll to c:\php directory. there is something in the httpd.conf file. Also, can you post the contents of httpd.conf file?

  23. Albert Christopher Daniot says:

    i’ve already copied the php5apache2_4.dll to c:\php\ext directory.
    here the whole code in httpd.conf file..:

    #
    # This is the main Apache HTTP server configuration file. It contains the
    # configuration directives that give the server its instructions.
    # See for detailed information.
    # In particular, see
    #
    # for a discussion of each configuration directive.
    #
    # Do NOT simply read the instructions in here without understanding
    # what they do. They’re here only as hints or reminders. If you are unsure
    # consult the online docs. You have been warned.
    #
    # Configuration and logfile names: If the filenames you specify for many
    # of the server’s control files begin with “/” (or “drive:/” for Win32), the
    # server will use that explicit path. If the filenames do *not* begin
    # with “/”, the value of ServerRoot is prepended — so “logs/access_log”
    # with ServerRoot set to “/usr/local/apache2″ will be interpreted by the
    # server as “/usr/local/apache2/logs/access_log”, whereas “/logs/access_log”
    # will be interpreted as ‘/logs/access_log’.
    #
    # NOTE: Where filenames are specified, you must use forward slashes
    # instead of backslashes (e.g., “c:/apache” instead of “c:\apache”).
    # If a drive letter is omitted, the drive on which httpd.exe is located
    # will be used by default. It is recommended that you always supply
    # an explicit drive letter in absolute paths to avoid confusion.

    #
    # ServerRoot: The top of the directory tree under which the server’s
    # configuration, error, and log files are kept.
    #
    # Do not add a slash at the end of the directory path. If you point
    # ServerRoot at a non-local disk, be sure to specify a local disk on the
    # Mutex directive, if file-based mutexes are used. If you wish to share the
    # same ServerRoot for multiple httpd daemons, you will need to change at
    # least PidFile.
    #
    ServerRoot “c:/Apache24″

    #
    # Mutex: Allows you to set the mutex mechanism and mutex file directory
    # for individual mutexes, or change the global defaults
    #
    # Uncomment and change the directory if mutexes are file-based and the default
    # mutex file directory is not on a local disk or is not appropriate for some
    # other reason.
    #
    # Mutex default:logs

    #
    # Listen: Allows you to bind Apache to specific IP addresses and/or
    # ports, instead of the default. See also the
    # directive.
    #
    # Change this to Listen on specific IP addresses as shown below to
    # prevent Apache from glomming onto all bound IP addresses.
    #
    #Listen 12.34.56.78:80
    Listen 80

    #
    # Dynamic Shared Object (DSO) Support
    #
    # To be able to use the functionality of a module which was built as a DSO you
    # have to place corresponding `LoadModule’ lines at this location so the
    # directives contained in it are actually available _before_ they are used.
    # Statically compiled modules (those listed by `httpd -l’) do not need
    # to be loaded here.
    #
    # Example:
    # LoadModule foo_module modules/mod_foo.so
    #
    LoadModule access_compat_module modules/mod_access_compat.so
    LoadModule actions_module modules/mod_actions.so
    LoadModule alias_module modules/mod_alias.so
    LoadModule allowmethods_module modules/mod_allowmethods.so
    LoadModule asis_module modules/mod_asis.so
    LoadModule auth_basic_module modules/mod_auth_basic.so
    #LoadModule auth_digest_module modules/mod_auth_digest.so
    #LoadModule authn_anon_module modules/mod_authn_anon.so
    LoadModule authn_core_module modules/mod_authn_core.so
    #LoadModule authn_dbd_module modules/mod_authn_dbd.so
    #LoadModule authn_dbm_module modules/mod_authn_dbm.so
    LoadModule authn_file_module modules/mod_authn_file.so
    #LoadModule authn_socache_module modules/mod_authn_socache.so
    #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
    LoadModule authz_core_module modules/mod_authz_core.so
    #LoadModule authz_dbd_module modules/mod_authz_dbd.so
    #LoadModule authz_dbm_module modules/mod_authz_dbm.so
    LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
    LoadModule authz_host_module modules/mod_authz_host.so
    #LoadModule authz_owner_module modules/mod_authz_owner.so
    LoadModule authz_user_module modules/mod_authz_user.so
    LoadModule autoindex_module modules/mod_autoindex.so
    #LoadModule buffer_module modules/mod_buffer.so
    #LoadModule cache_module modules/mod_cache.so
    #LoadModule cache_disk_module modules/mod_cache_disk.so
    #LoadModule cern_meta_module modules/mod_cern_meta.so
    LoadModule cgi_module modules/mod_cgi.so
    #LoadModule charset_lite_module modules/mod_charset_lite.so
    #LoadModule data_module modules/mod_data.so
    #LoadModule dav_module modules/mod_dav.so
    #LoadModule dav_fs_module modules/mod_dav_fs.so
    #LoadModule dav_lock_module modules/mod_dav_lock.so
    #LoadModule dbd_module modules/mod_dbd.so
    #LoadModule deflate_module modules/mod_deflate.so
    LoadModule dir_module modules/mod_dir.so
    #LoadModule dumpio_module modules/mod_dumpio.so
    LoadModule env_module modules/mod_env.so
    #LoadModule expires_module modules/mod_expires.so
    #LoadModule ext_filter_module modules/mod_ext_filter.so
    #LoadModule file_cache_module modules/mod_file_cache.so
    #LoadModule filter_module modules/mod_filter.so
    #LoadModule headers_module modules/mod_headers.so
    #LoadModule heartbeat_module modules/mod_heartbeat.so
    #LoadModule heartmonitor_module modules/mod_heartmonitor.so
    #LoadModule ident_module modules/mod_ident.so
    #LoadModule imagemap_module modules/mod_imagemap.so
    LoadModule include_module modules/mod_include.so
    #LoadModule info_module modules/mod_info.so
    LoadModule isapi_module modules/mod_isapi.so
    #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
    #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
    #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
    #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
    #LoadModule ldap_module modules/mod_ldap.so
    #LoadModule logio_module modules/mod_logio.so
    LoadModule log_config_module modules/mod_log_config.so
    #LoadModule log_debug_module modules/mod_log_debug.so
    #LoadModule log_forensic_module modules/mod_log_forensic.so
    #LoadModule lua_module modules/mod_lua.so
    LoadModule mime_module modules/mod_mime.so
    #LoadModule mime_magic_module modules/mod_mime_magic.so
    LoadModule negotiation_module modules/mod_negotiation.so
    #LoadModule proxy_module modules/mod_proxy.so
    #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
    #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
    #LoadModule proxy_connect_module modules/mod_proxy_connect.so
    #LoadModule proxy_express_module modules/mod_proxy_express.so
    #LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
    #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
    #LoadModule proxy_html_module modules/mod_proxy_html.so
    #LoadModule proxy_http_module modules/mod_proxy_http.so
    #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
    #LoadModule ratelimit_module modules/mod_ratelimit.so
    #LoadModule reflector_module modules/mod_reflector.so
    #LoadModule remoteip_module modules/mod_remoteip.so
    #LoadModule request_module modules/mod_request.so
    #LoadModule reqtimeout_module modules/mod_reqtimeout.so
    #LoadModule rewrite_module modules/mod_rewrite.so
    #LoadModule sed_module modules/mod_sed.so
    #LoadModule session_module modules/mod_session.so
    #LoadModule session_cookie_module modules/mod_session_cookie.so
    #LoadModule session_crypto_module modules/mod_session_crypto.so
    #LoadModule session_dbd_module modules/mod_session_dbd.so
    LoadModule setenvif_module modules/mod_setenvif.so
    #LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
    #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
    #LoadModule socache_dbm_module modules/mod_socache_dbm.so
    #LoadModule socache_memcache_module modules/mod_socache_memcache.so
    #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
    #LoadModule speling_module modules/mod_speling.so
    #LoadModule ssl_module modules/mod_ssl.so
    #LoadModule status_module modules/mod_status.so
    #LoadModule substitute_module modules/mod_substitute.so
    #LoadModule unique_id_module modules/mod_unique_id.so
    #LoadModule userdir_module modules/mod_userdir.so
    #LoadModule usertrack_module modules/mod_usertrack.so
    #LoadModule version_module modules/mod_version.so
    #LoadModule vhost_alias_module modules/mod_vhost_alias.so
    #LoadModule watchdog_module modules/mod_watchdog.so
    #LoadModule xml2enc_module modules/mod_xml2enc.so

    #
    # If you wish httpd to run as a different user or group, you must run
    # httpd as root initially and it will switch.
    #
    # User/Group: The name (or #number) of the user/group to run httpd as.
    # It is usually good practice to create a dedicated user and group for
    # running httpd, as with most system services.
    #
    User daemon
    Group daemon

    # ‘Main’ server configuration
    #
    # The directives in this section set up the values used by the ‘main’
    # server, which responds to any requests that aren’t handled by a
    # definition. These values also provide defaults for
    # any containers you may define later in the file.
    #
    # All of these directives may appear inside containers,
    # in which case these default settings will be overridden for the
    # virtual host being defined.
    #

    #
    # ServerAdmin: Your address, where problems with the server should be
    # e-mailed. This address appears on some server-generated pages, such
    # as error documents. e.g. admin@your-domain.com
    #
    ServerAdmin admin@example.com

    #
    # ServerName gives the name and port that the server uses to identify itself.
    # This can often be determined automatically, but we recommend you specify
    # it explicitly to prevent problems during startup.
    #
    # If your host doesn’t have a registered DNS name, enter its IP address here.
    #
    ServerName http://www.example.com:80

    #
    # Deny access to the entirety of your server’s filesystem. You must
    # explicitly permit access to web content directories in other
    # blocks below.
    #

    AllowOverride none
    Require all denied

    #
    # Note that from this point forward you must specifically allow
    # particular features to be enabled – so if something’s not working as
    # you might expect, make sure that you have specifically enabled it
    # below.
    #

    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    DocumentRoot “c:/Apache24/htdocs”

    #
    # Possible values for the Options directive are “None”, “All”,
    # or any combination of:
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that “MultiViews” must be named *explicitly* — “Options All”
    # doesn’t give it to you.
    #
    # The Options directive is both complicated and important. Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be “All”, “None”, or any combination of the keywords:
    # Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted

    #
    # DirectoryIndex: sets the file that Apache will serve if a directory
    # is requested.
    #

    DirectoryIndex index.html index.php

    #
    # The following lines prevent .htaccess and .htpasswd files from being
    # viewed by Web clients.
    #

    Require all denied

    #
    # ErrorLog: The location of the error log file.
    # If you do not specify an ErrorLog directive within a
    # container, error messages relating to that virtual host will be
    # logged here. If you *do* define an error logfile for a
    # container, that host’s errors will be logged there and not here.
    #
    ErrorLog “logs/error.log”

    #
    # LogLevel: Control the number of messages logged to the error_log.
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    #
    LogLevel warn

    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”" combined
    LogFormat “%h %l %u %t \”%r\” %>s %b” common

    # You need to enable mod_logio.c to use %I and %O
    LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\” %I %O” combinedio

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a
    # container, they will be logged here. Contrariwise, if you *do*
    # define per- access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog “logs/access.log” common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog “logs/access.log” combined

    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server’s namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL. You will also likely
    # need to provide a section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client. The same rules about trailing “/” apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ “c:/Apache24/cgi-bin/”

    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock cgisock

    #
    # “c:/Apache24/cgi-bin” should be changed to whatever your ScriptAliased
    # CGI directory exists, if you have that configured.
    #

    AllowOverride None
    Options None
    Require all granted

    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to “handlers”:
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add “ExecCGI” to the “Options” directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add “Includes” to the “Options” directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml

    #
    # The mod_mime_magic module allows the server to use various hints from the
    # contents of the file itself to determine its type. The MIMEMagicFile
    # directive tells the module where the hint definitions are located.
    #
    #MIMEMagicFile conf/magic

    #
    # Customizable error responses come in three flavors:
    # 1) plain text 2) local redirects 3) external redirects
    #
    # Some examples:
    #ErrorDocument 500 “The server made a boo boo.”
    #ErrorDocument 404 /missing.html
    #ErrorDocument 404 “/cgi-bin/missing_handler.pl”
    #ErrorDocument 402 http://www.example.com/subscription_info.html
    #

    #
    # MaxRanges: Maximum number of Ranges in a request before
    # returning the entire resource, or one of the special
    # values ‘default’, ‘none’ or ‘unlimited’.
    # Default setting is to accept 200 Ranges.
    #MaxRanges unlimited

    #
    # EnableMMAP and EnableSendfile: On systems that support it,
    # memory-mapping or the sendfile syscall may be used to deliver
    # files. This usually improves server performance, but must
    # be turned off when serving from networked-mounted
    # filesystems or if support for these functions is otherwise
    # broken on your system.
    # Defaults: EnableMMAP On, EnableSendfile Off
    #
    #EnableMMAP off
    #EnableSendfile on

    # Supplemental configuration
    #
    # The configuration files in the conf/extra/ directory can be
    # included to add extra features or to modify the default configuration of
    # the server, or you may simply copy their contents here and change as
    # necessary.

    # Server-pool management (MPM specific)
    #Include conf/extra/httpd-mpm.conf

    # Multi-language error messages
    #Include conf/extra/httpd-multilang-errordoc.conf

    # Fancy directory listings
    #Include conf/extra/httpd-autoindex.conf

    # Language settings
    #Include conf/extra/httpd-languages.conf

    # User home directories
    #Include conf/extra/httpd-userdir.conf

    # Real-time info on requests and configuration
    #Include conf/extra/httpd-info.conf

    # Virtual hosts
    #Include conf/extra/httpd-vhosts.conf

    # Local access to the Apache HTTP Server Manual
    #Include conf/extra/httpd-manual.conf

    # Distributed authoring and versioning (WebDAV)
    #Include conf/extra/httpd-dav.conf

    # Various default settings
    #Include conf/extra/httpd-default.conf

    # Configure mod_proxy_html to understand HTML4/XHTML1

    Include conf/extra/proxy-html.conf

    # Secure (SSL/TLS) connections
    #Include conf/extra/httpd-ssl.conf
    #
    # Note: The following must must be present to support
    # starting without SSL on platforms with no /dev/random equivalent
    # but a statically compiled-in mod_ssl.
    #

    SSLRandomSeed startup builtin
    SSLRandomSeed connect builtin

    # Deal with user agents that deliberately violate open standards
    #

    BrowserMatch “MSIE 10.0;” bad_DNT

    RequestHeader unset DNT env=bad_DNT

    LoadModule php5_module “c:/php/ext/php5apache2_4.dll”
    AddHandler application/x-httpd-php .php

    # configure the path to php.ini
    PHPIniDir “C:/php”

  24. Paul Rowley says:

    Hi there. I have followed your brilliant instructions 100% to the letter, I know I have but I constantly get this error:

    httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P
    HP/php5apache2_2.dll into server: The specified procedure could not be found.

    C:\apache24\bin>httpd -S
    httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P
    HP/php5apache2_4.dll into server: The specified procedure could not be found.

    C:\apache24\bin>httpd -k start
    httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P
    HP/php5apache2_4.dll into server: The specified procedure could not be found.

    C:\apache24\bin>httpd -S
    httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P
    HP/ext/php5apache2_4.dll into server: The specified procedure could not be found
    .

    C:\apache24\bin>httpd -S
    httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P
    HP/ext/php5apache2_4.dll into server: The specified procedure could not be found
    .

    C:\apache24\bin>httpd -k start
    httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P
    HP/ext/php5apache2_4.dll into server: The specified procedure could not be found
    .

    C:\apache24\bin>httpd -S
    httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/p
    hp/ext/php5apache2_4.dll into server: The specified procedure could not be found
    .

    C:\apache24\bin>httpd -S
    httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/p
    hp/ext/php5apache2_4.dll into server: The specified procedure could not be found
    .

    I just can’t get it to work.

    Windows Vista 32

    • newlife007 says:

      Have you copied php5apache2_4.dll to the c:/php directory? Also, you don’t need to reference php5apache2_2.dll in the httpd.conf file, that’s for Apache 2.2. All the errors point to the php5apache2_4.dll is not in the c:/php directory. That is the only thing I can see from the errors.

  25. Paul Rowley says:

    Not sure whether this will ever help anyone, I had to go back to Apache 2.2 eventually not going to bother with 2.4 at the moment.

    To get Apache working without errors (PHP too) I had to stop the MSSQL reporting service on the server I’m using for testing.

    Once I had done that, apache stopped bitching, I re-installed PHP and everything works.

    Thanks for all your help. I will try your great article again soon with 2_4.

    • Boris says:

      I had the same problem. Looks like there is a problem with php dll, because if you read the error message more carefully it tells that “the specified module could not be found” (not the file but *module*), which is php5_module. I installed earlier version of php 2.4.0 with php5apache2_4.dll for that version and it solved the problem.

      Also, there is an error in the test php file. It should look like:

      Not with ‘$’ on the last line.

      • newlife007 says:

        Boris, That was my typo in the test.php it should be a ? instead of $. And it is the PHP 5.4.0 version that I installed for this post and have not updated to 5.4.8 which is possible to be causing an issue with the module’s. I am currently running Apache 2.4.1 / PHP 5.4.0 built with the exact instructions. I see there is Apache 2.4.3 / PHP 5.4.8 available and will update and see if I get the same issue.

        Update: I was able to update to Apache 2.4.3(httpd-2.4.3-win32-ssl_0.9.8.zip ) | PHP 5.4.8 VC9 x86 Thread Safe (2012-Oct-17 22:45:30) with the latest php5apache2_4.dll-php-5.4-win32.zip 18 Oct ’12. In the extract php5apache2_4.dll there are sub directories corresponding to the PHP version. I just copied the one from 5.4.8 directory and it all works.

  26. xiechaofeng says:

    think you

  27. pera says:

    Thanks man, your article was helpful.

    • Naseem says:

      The Apache service named reported the following error:
      >>> httpd.exe: Syntax error on line 526 of C:/Apache24/conf/httpd.conf: Cannot load c:/php/ext/php5apache2_2.dll into server: The specified module could not be found. any help would be appreciated

      • Naseem says:

        or The Apache service named reported the following error:
        >>> httpd.exe: Syntax error on line 526 of C:/Apache24/conf/httpd.conf: Cannot load c:/php/ext/php5apache2_4.dll into server: The specified procedure could not be found.

        • newlife007 says:

          Make sure the the correct dll is in the c:/php/ext directory because you have to put it there and double check the entry in the httpd.conf file. Also, look at the comment from Boris on a similar issue he had with the version of the dll and had to download it. The download contains a dll for each point revision in it.

  28. Joe says:

    Thanks, worked very well for me.

  29. abhinab saikia says:

    Thanks for your valuable suggestions.. I am trying to doing the same for windows 7 64 bit. Will this procedure work for 64 bit version also?
    thanks in advance

    • newlife007 says:

      Thank you for the comment n the process and es it will work on Windows 7 64-bit, that’s the system I based to post on.

  30. abhinab saikia says:

    Thank you..tried it and its working thanks a lot.

  31. Lucho says:

    reported the following error

    C:\Users\LARM>c:\Apache24\bin\httpd -S
    httpd: Syntax error on line 525 of C:/Apache24/conf/httpd.conf: Cannot load c:/php/php5apache2_4.dll into server: No se puede encontrar el m\xf3dulo especificado.

  32. abhinabsaikia says:

    i am not able to load the mysql ..libmysql.dll is not there.how to find it and install it

    • newlife007 says:

      In the post part way down there are instructions on where and how.

      MySQL
      Download and install mysql-5.5.21-win64.msi http://dev.mysql.com/downloads/mysql/ . Change installation directory to C:\MySQL\MySQL Server 5.5 instead of Program files as there could be permissions issues. Once the installation is completed you can let the configuration wizard run and setup the database server. The defaults will work just fine, but remember what you set the password to for root.

  33. dts says:

    Wondering if anyone can help me with the same problem reported here 1000 times. I’ve read all the comments, but I’m still stuck, somehow. It starts with the error, on Windows 7:

    [C:\Apache24\bin]httpd -k start
    httpd: Syntax error on line 525 of C:/Apache24/conf/httpd.conf: Cannot load c:/php/php5apache2_4.dll into server: The specified procedure could not be found.

    The files I’ve downloaded are:
    php-5.4.9-Win32-VC9-x86.zip
    httpd-2.4.3-win32.zip
    php5apache2_4.dll-php-5.2-win32.zip

    I have VC10 redist installed.

    PHP installed fine, and lives in c:\php. In the c:\php\ folder I have:
    12/10/2012 10:51 26,624 php5apache2_2.dll
    12/10/2012 10:51 26,112 php5apache2_3.dll
    12/10/2012 11:18 25,600 php5apache2_4.dll

    And my addition to the httpd.conf file reads as follows:

    LoadModule php5_module “c:/php/php5apache2_4.dll”
    AddHandler application/x-httpd-php .php
    PHPIniDir “C:/php”

    What have I missed?

    Thanks in advance,
    Dave

    • newlife007 says:

      have you checked to make sure that c:\php is in your path environment variable for the system? I created this doc using a Windows 7 64 bit system and used it several times with only 1 issues which was c:\php not being in the path. If you make a change to the variable you will need to reboot.

      • dts says:

        Yes, I’ve tried it both with and without c:\php in the path. Just to confirm the correct pathing, I ran this command:

        C:\Apache24\bin>php -r “print ‘a’;”

        …which executed as expected, and printed an “a”.

        Still stumped :(

  34. dts says:

    I’m wondering … is it significant that some people report the error as “the specified module” and some (like me) as “the specified procedure?” Perhaps there are really two issues that have a very similar error message? I would expect a path problem to produce an error about a “module” and a component version problem to produce an error about a “procedure.” Maybe?

    • newlife007 says:

      The errors are pretty much the same and related. If you look at the comments you see the issue multiple times and each resolution is a bit different. Here’s what I would check.

      From list you downloaded it looks like you have PHP 5.4.9 but downloaded the PHP 5.2 dll’s Download http://www.apachelounge.com/download/win32/modules-2.4/php5apache2_4.dll-php-5.4-win32.zip and copy the dll in the PHP 5.4.9 directory to c:\php. It is very important that the version of PHP and the modules match. Look http://www.apachelounge.com/download/ in the Apache 2.4 win32 modules section and you’ll notice there are 3 different zip’s to download.

      Otherwise recheck the c:\php\php.ini and c:\Apache24\conf\httpd.conf edits. The main things to look at are correct versions, file location, environment PATH and configuration file edits.

      • dts says:

        Amazingly, this now works! I downloaded the file you mentioned, and replaced the version of php5apache2_4.dll that I had (lovely that there are multiple versions of the same filename out there …) and after 10 – 20 iterations of trying to get “httpd -k” commands like uninstall, start, restart, shutdown, etc to work, I finally hit some combination that stopped giving me an error message. Not as scientific or deterministic as I would have liked, but it actually serves up a php page now.

        Thanks so much for your help!

  35. pp says:

    Hello Sir..
    there is a problem while im testing the info.php.My browser showing a blank page.pliz help me sir.
    thank u

  36. pp says:

    thanx sir..i hv done it.:)
    Sir wht is the difference b/w PHP 5.4 VC9 x86 Thread Safe and PHP 5.4 VC9 x86 Thread un Safe.

    • newlife007 says:

      The difference is Thread Safe is multi-threaded and Non Thread Safe is single threaded. Windows is multi-threaded OS, so thread safe is the version to use. Using non thread safe will decrease performance but there are reasons for using it and that i why it is available. Glad to see you have it running.

  37. BigDuy01 says:

    I’m getting this error when i run it:

    Errors reported here must be corrected before the service can be started.
    httpd: Syntax error on line 525 of C:/Apache24/conf/httpd.conf: Cannot load c:/php/ext/php5apache2_4.dll into server: The specified module could not be found.

    But I know for sure c:/php/ext/php5apache2_4.dll is there:
    C:\php\ext>dir php5*
    Volume in drive C has no label.
    Volume Serial Number is 4258-A68C

    Directory of C:\php\ext

    11/29/2012 05:16 AM 25,088 php5apache2_4.dll

    What do I need to do to fix this. Please help.

    • newlife007 says:

      The errors are pretty much the same and related. If you look at the comments you see the issue multiple times and each resolution is a bit different. Here’s what I would check.

      From list you downloaded it looks like you have PHP 5.4.9 but downloaded the PHP 5.2 dll’s Download http://www.apachelounge.com/download/win32/modules-2.4/php5apache2_4.dll-php-5.4-win32.zip and copy the dll in the PHP 5.4.9 directory to c:\php. It is very important that the version of PHP and the modules match. Look http://www.apachelounge.com/download/ in the Apache 2.4 win32 modules section and you’ll notice there are 3 different zip’s to download.

      Otherwise recheck the c:\php\php.ini and c:\Apache24\conf\httpd.conf edits. The main things to look at are correct versions, file location, environment PATH and configuration file edits.

  38. namastu says:

    “Open a command prompt and type.
    c:\apache24\bin\httpd -k install”

    Sorry, you are missing exe. So it should be “c:\apache24\bin\httpd.exe -k install”.

    This is very crucial for beginners.

    • newlife007 says:

      As long as the system doesn’t have it’s extensions incorrect this is not really an issue not to have it. If they have a command or bat file of the same name it can be an issue. But it is a valid point.

  39. kou says:

    When i execute php -m i still get nothing. Confused and lost.

  40. Thomas Digby says:

    Good article, I always looks for quick guides when installing Apache/PHP as there’s always a little part I’ll forget. Just one thing though:

    I found that sticking the ‘php5apache2_4.dll’ in the ext directory didn’t work. However placing it in the root PHP folder did. Not sure whether it’s just a localised case or whether you want to consider updating the original article.

    • newlife007 says:

      I have done it both ways. The key is to make sure the path is defined in the httpd.conf file, you have the correct version of the dll to match the PHP version and also to uncomment the extension_dir = “ext” in the php.ini file. I prefer to use this method because there are other dll’s in the ext directory that can be enabled. What I probably will do is edit the post and create options. Check back shortly and you’ll see I updated the post to have 2 options.

  41. This guide helped me so much! I have been trying to get phpMyAdmin, Apache, PHP and MySQL installed on my laptop for so long but there were so many guides that didnt tell me how to. First time I find this…and it works! Thankyou so much!

  42. SHARDUL says:

    i m using the same config but when i run php code and use ‘\n’ newline char then in the browser its result is not shown. how to correct this.which php setting has to be change. magic or what and how?

    • newlife007 says:

      I am not sure I follow you on when you are using ‘\n’ newline character. Are you using it for the test php file?

  43. dougi says:

    if i type php -m in the command prompt the mysql and mysqli extensions are listed but i get an error message when trying to use them in my scripts

    • newlife007 says:

      What error message are you getting when you try to access them? Have you added the C:\PHP directory in you path environment variable?

      • dougi says:

        Fatal error: Call to undefined function mysql_connect() in C:\Apache24\htdocs\moonlight\includes\mysql_connect.php on line 9. yes i have added the C:\php directory to my path environment variable

        • newlife007 says:

          What is in your mysql_connect.php for lines 8 – 10. If php -m is showing the modules and it is in your path it could be an issue with the connection parameters.

          • dougie says:

            this is the code in the mysql_connect file

            when i ran the phpinfo() file, the mysql and mysqli extensions are not listed. instead the mysqln extension is listed.

          • newlife007 says:

            Check your c:\php\php.ini file and make sure the edits are there for the extensions directory. The mysql modules are located in the c:\php\ext directory and you have to make sure it knows it.

            Uncomment the extension directory directive.

            extension_dir = “ext”

            Uncomment mysql modules

            extension=php_mysql.dll
            extension=php_mysqli.dll

  44. dougie says:

    they are as you have written

    • newlife007 says:

      btw, the mysql_connect file lines didn’t show in the reply earlier can you post them once more and let’s see if we can get this working for you

  45. dougie says:

    this is the mysql_connect.php code

    can’t access phpmyadmin as well. it’s saying the mysqli extension is missing

  46. dougie says:

    problem solved. had to change extension_dir = “ext” to extension_dir = “C:/php/ext”

    • newlife007 says:

      Did you reboot the system after you added c:\php to the environment path variable? That’s what it sounds like what was happening. Glad to see you have a solution

  47. Piko says:

    I’ve installed everything as mention here.

    PHP is working, but includes not…

    I’ve the following line on index.php on root:

    include (“/includes/all_includes.inc.php”);

    Inside that PHP have:

    $includes_path= “”;

    echo(“Base_Path: ” . $includes_path);

    include ($includes_path . “settings.inc.php”);
    include ($includes_path . “database.inc.php”);

    However, keep having the error that the class is not available..

    Have this tested and working on Apache 2.2.3 on CentOS Linux and it is working properly…

    Path is already configured on System Variables…

  48. Piko says:

    I’ve installed everything as mention here.

    PHP is working, but includes not…

    I’ve the following line on index.php on root:

    include (“/includes/all_includes.inc.php”);

    Inside that PHP have:

    $includes_path= “”;

    echo(“Base_Path: ” . $includes_path);

    include ($includes_path . “settings.inc.php”);
    include ($includes_path . “database.inc.php”);

    However, keep having the error that the class is not available..

    Have this tested and working on Apache 2.2.3 on CentOS Linux and it is working properly…

    Path is already configured on System Variables…

  49. Piko says:

    Manage to solve it…

    It happens that I forgot to change this:

    short_open_tag = Off

    to this:

    short_open_tag = On

    Felling a little bit dumb now…

  50. Andy Sabo says:

    I followed your instructions and it worked flawlessly.
    Thank you for your contribution. This is a well written article.

    • newlife007 says:

      I appreciate the feedback and glad you found the guide useful, I try to post items that I use at my job to help others who maybe having the same issues that are not the normal postings on the web.

  51. hcuser says:

    thanks, this tutorial is very helpful…

    one question:
    can’t seem to be able to enable vhost on apache2.4.3, anyone know how?

  52. wlfbck says:

    Hey, there is a little error in your guide:
    You mention that php5apache2_4.dll is included in php5.4.10 and higher, but atleast in the currently available version 5.4.14 this is not the case. There is only a php5.dll and it doesn’t work with it, i get this error when trying to install:
    httpd: Syntax error on line 526 of C:/Apache24/conf/httpd.conf: Can’t locate API module structure `php5_module’ in file C:/Apache24/php/php5.dll: No error
    (I moved the php folder inside the Apache24 folder to have it one place, but that shouldn’t be a problem)

    • newlife007 says:

      Last time I checked it was there at the last update. It is possible they may have removed it or made changes as they have in the past and that’s why there have been updates to this post. Upon checking I see they have made changes for the VC10 and VC11 builds. There is also a note. VC9 – PHP Handler modules PHP 5.2, 5.3 and 5.4 for Apache 2.4. Note: 5.4 and 5.3 module included now in the official PHP binaries. Thanks for the comment I will update the post when I get the chance.

      • wlfbck says:

        Wow, thanks for the quick answer :) I’m unfortunately an idiot. Confirmed three times that i was clicking the thread safe php binary… I was not, it was VC9 x86 Non Thread Safe. So, your guide is still correct, maybe just add in a line for idiots like me who can’t find that they very probably downloaded the wrong binary^^

  53. Tommy Jay says:

    I tried to test php -m and got the error ‘php’ is not recognized as an internal or external command. Any ideas why?
    Thanks

  54. Roy says:

    do you know how to use MariaDB for php5? thank you

  55. How do I do an upgrade of PHP or apache without changing the config file everytime?

    • newlife007 says:

      For PHP I would copy the php.ini file before running the upgrade install and you will have to replace the php5apache2_4.dll file to match the version you are upgrading to. With Apache copy the httpd.conf file and perform the upgrade.

  56. Giancarlo says:

    What is the password of the file php5apache2_4.dll-php-5.4-win32.zip? I can’t put the file in PHP folder because this.

  57. Can you tell how to configure Apache Tomcat on Windows? Right now, I’m relying on NetBeans but I want to know how to use it standalone

  58. Hi I followed along but when I did httpd -S I get “Syntax error on line 528……%1 is not a valid Win32 application”

    I went back through and checked everything against each instruction and it all looks the same.

    Any ideas or insight you could provide would be very much appreciated.

  59. newlife007 This is from line 525 to the end of the file, wasn’t sure if a previous line had an error or not:

    #RequestHeader unset DNT env=bad_DNT
    #

    LoadModule php5_module “c:/opt/local/php/php5apache2_4.dll”
    AddHandler application/x-httpd-php .php
    PHPIniDir “C:/opt/local/php”

    I changed the environment variable as noted in your post also. So I’m kind of at a loss of what the culprit could be.

  60. Will re-download each piece and be aware of those minute details, it’s those little things that always getcha. Thanks again newlife007!

  61. Yup did a complete uninstall of everything and redownloaded fresh copies of each file and now works smoothly.

    Thank you again for your help!

  62. Ameya says:

    Hi, I followed all the steps and they work except the last one. I downloaded and saved the phpmyadmin folder as you have directed. but what changes do I need to make in config directory? when I try to access phpmyadmin it gives me internal server error. What should I do to get it working?

    • newlife007 says:

      Create a config directory under your phpmyadmin directory. Open a browser and type http://localhost/phpmyadmin/setup/index.php. You will have to give it root for the user account and the accounts password and it should finish the installation.

      • Ameya says:

        Hi,
        I am still getting an issue in installing phpmyadmin(4.0.6). I’m using Apache 2.4.6 and PHP 5.5.3. I’m getting an error “The mbstring extension is missing. Please check your PHP configuration.”
        When I see into the ‘ext’ folder of php, ‘php_mbstring.dll’ is present. Also in php.ini, I’ve uncommented ‘extension=php_mbstring.dll’. What should I do to make it work?

    • Jason says:

      I had to uncomment extension=php_mbstring.dll in the php.ini file and then restart the apache server. Once I did this I could access the phpMyAdmin page from http://localhost/phpmyadmin/index.php.

    • Ameya says:

      Yes I had.
      I ‘m running into a new issue. I’m trying to setup all on a VDI. so I had to make apache listen to 8080 instead of 80. so when I typle localhost:8080 i get to the page ‘It works!’ but when I try localhost:8080/info.php I get a 404 error. “The requested URL /info.php was not found on this server.”
      and getting the same error for phpmyadmin. (irrespective of absolute or relative path for ‘ext’.)

  63. Joe C says:

    So would you do it again? Or would you stick with installing wamp/xampp?

    • newlife007 says:

      I would do it again and have on many other systems. It makes it easy for me to update individual components and not have to rely on package updates, plus let me customize my setup.

  64. I found the same file but not including the password at keygenpen.

  65. Mark says:

    Thank you!! Your instructions were excellent and saved me hours of confusion. Thanks again.

  66. Ruskin says:

    When I start httpd.exe command as per the instructions written in Read me file. I encountered following error. Could you please point out why i did receive such error. I Means what more work to be do now.

    httpd.exe: Syntax error on line 72 of C:/Apache24/conf/httpd.conf: Cannot load modules/mod_access_compat.so into server: The specified module could not be found.

    • newlife007 says:

      Look in the c:\Apache24\modules directory for the mod_access_compat.so file. That is a standard module for Apache 2.4. If it is not there open the zip file you have and extract and copy to there. Also, make sure that you put c:\apach24 in you system environment variable’s path and have rebooted the system.

      • James says:

        I ran into this issue as well. I found my ServerRoot variable was not set to the correct path. Therefore none of the modules could be found.

  67. MartinN says:

    Excellent article, many thanks :)

  68. JanelleD says:

    Hi Sir, I have a question because I followed the steps above but when I tried to register the Apache Service in the command line it shows this error “The program can’t start because MSCVR110.dll is missing in your computer. Try reinstalling the program to fix the problem”

    Please help. Thank you. More power.

  69. Ameya says:

    What are the instructions to install these on a VDI? I am trying to install one and I have to make the server listen to 8080. Also info.php can’t be found on localhost:8080/info.php.

  70. Bharat says:

    I was looking for options without WAMP and stumbled upon this. Worked great for me… thanks much

  71. Ameya says:

    Hi I have installed Apache 2.4.6 , PHP 5.5.3 and MYSQL Server 5.6 on a Windows7 machine.
    I’m running into a new issue , I can’t upload any files on the site. I can’t run cron. And also I can’t reference any child nodes while creating a page.

    Can you tell me what could be an issue?

    • newlife007 says:

      The setup seems like it is working, what you are trying to do is turning on some other features. Let’s clear the cron question. cron is only on Unix / Linux systems, for Windows use Task Scheduler, some starter information here http://windows.microsoft.com/en-us/windows7/schedule-a-task. The referencing of the child nodes sounds like a DNS issue which you could edit the c:\windows\system32\etc\drivers\hosts file and add the entries in there or if you have a local DNS server running add the records. As for the uploading files it depends on how you are trying to and where from. You could install FTP service and SSH (CopSSH) or if you are coding in PHP you can make the config changes in PHP to allow for file uploads. If it is Apache uploads for sites and such look at FTP and SSH options for Windows.

  72. Ilker says:

    Thanks much!

  73. Ameya says:

    Thanks. Let me try it and update you.

  74. arie says:

    it works! thank you dude!

    i wrote this into my blog!

  75. roshan says:

    first of all thanx for this easiest tutorial.
    i hv installed php 5.4.9 with apache 2.4. everything is working but when i enter in cmd prompt

    C:\>apache24\bin\httpd -k start

    it shows

    only one usage of each socket address is normally permitted. : AH00072: make_sock: could not bind to address [::]:80
    only one usage of each socket address is normally permitted. : AH00072: make_sock: could not bind to address 0.0.0.0:80
    AH00451: no listening sockets available, shutting down
    AH00015: unable to open log.

    this is what i am not getting.

    plz suggest some solution….

    thanx

    • newlife007 says:

      Edit c:\Apache24\conf\httpd.conf and find the line ServerName and type in your systems ip address and or the name followed by the port 80. Save the changes and try restarting

      Example:
      ServerName 192.168.1.150:80

      or
      ServerName tardis:80

  76. Excellent article! We are linking to this particularly great content
    on our website. Keep up the great writing.

  77. steve says:

    You have a nice site, lot of work, so am a little reticent to ask this but….

    Could you put a page somewhere where you listed the OS and the current apps & links

    ie…

    Windows 7 32 bit
    Apache xxxxx http
    PHP xxxxx http
    Mysql xxxx http

    any special instructions ….

    Windows 7 64 bit ..

  78. Barry Joyce says:

    I’ve followed these instructions on a new windows 8.1 machine. I’ve downloaded the current VC11 versions of php and apache and whilst apache runs successfully as soon as I try to link in php I get the error message “The requested operation has failed”. I’ve tried commenting everything else out just leaving the

    ‘LoadModule php5_module “c:/php/php5apache2_4.dll”‘

    line in with the same result.

    Any ideas?

    • newlife007 says:

      Do you have single quotes around the line? If you do the need to be removed. The lines should look like this

      LoadModule php5_module “c:/php/php5apache2_4.dll”
      AddHandler application/x-httpd-php .php

      and check to make sure php5apache2_4.dll is there. One last thing is to make sure your path includes c:\php in it and you have rebooted the system. Open a command prompt with Administrator rights and type set path=%path%;c:\php. This will put it in the path, restart apache and try again. This will add c:\php for the session.

  79. Barry Joyce says:

    Thanks NewLife007,

    No I didn’t have the single quotes around the line in question but had omitted to add c:\php to the path variable. That added I’m afraid that I’m still getting the same message.

    • Barry Joyce says:

      I read that this error is possibly due to an interaction with an old anti-virus software package that had been uninstalled but fragment left behind. I had uninstalled Norton Internet Security and installed the free version of AVG so I went back to my fresh install with Norton but I’m still getting the same message – sadly a waste of time

      • newlife007 says:

        I have never heard of Anti-Virus causing and issue unless it quarantined the file. With this error is it usually syntax in httpd.conf, c:\php is not in the path or the file is missing. One other thing to look for is in c:\php\php.ini file and uncomment extension_dir and set the path to where the dll resides, look at the examople below.

        ; Directory in which the loadable extensions (modules) reside.
        ; http://php.net/extension-dir
        ; extension_dir = “./”
        ; On windows:
        extension_dir = “./”

        • Barry Joyce says:

          Thanks very much for your help but I’ve given in and installed xampp which installed and worked without trouble – shame

  80. JS-ITAdmin says:

    Question, I have read your post and it is very descriptive so thanks for putting in all the work. My question is once it is all up and running how hard is it to do the installation of udpates to all 3 modules? Since Apache, PHP, and MySQL don’t necessarily synch there security patches or updates would you just need to keep a test environment to see if anything breaks?

    • newlife007 says:

      It is always good to have a development environment to test out patches and new versions. I practice that myself. What I have found as far as applying the updates I always backup the config files first as they could get overwritten and erase all your hard work.

  81. Efox says:

    Hello, this looks like exactly what I was looking for. But this was written in 2012, but it looks like through the comments it h as been updated for 2014. So I am wondering do your instructions apply for 2014?

    I want to install Apache, PHP and MYSQL Server. I know I could just install WAMP or XAMP, but I am wanting to install them individulay so I can starting learning how all of this works together for programming and database administration.

    BTW, thanks for this posting.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

top

Switch to our mobile site