Life of a Geek Admin

The Daily adventures of a true geek administrator

Life of a Geek Admin - The Daily adventures of a true geek administrator

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

Category: Windows
  • spaderz says:

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

    March 21, 2012 at 9:18 pm
    • 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.

      March 21, 2012 at 10:56 pm
      • 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!

        March 31, 2012 at 2:58 pm
        • Pushkar says:

          If you have requested for notification, look for subscription options URL at the bottom of the email. Click on it and make your changes. Cheers!

          March 31, 2012 at 3:35 pm
          • newlife007 says:

            Thanks Pushkar for the quick reply!

            March 31, 2012 at 3:38 pm
      • 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 .

        March 31, 2012 at 3:11 pm
    • 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.

      March 31, 2012 at 7:09 am
  • 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…

    March 23, 2012 at 11:59 am
    • spaderz says:

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

      March 23, 2012 at 1:13 pm
      • 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!!)

        March 31, 2012 at 8:49 am
      • 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!)

        March 31, 2012 at 9:30 am
    • 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:

      March 31, 2012 at 7:17 am
      • 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”

        March 31, 2012 at 3:35 pm
    • 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 .

      March 31, 2012 at 7:26 am
    • Squishy says:

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

      March 31, 2012 at 9:43 am
    • Pandu says:

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

      March 31, 2012 at 10:17 am
    • 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.

      May 14, 2012 at 2:54 pm
      • 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.

        May 14, 2012 at 5:26 pm
  • Kejjden says:

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

    March 23, 2012 at 5:57 pm
    • 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 .

      March 31, 2012 at 9:20 am
  • 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.

    March 26, 2012 at 3:40 pm
    • 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.

      March 26, 2012 at 10:08 pm
  • 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!

    March 27, 2012 at 6:27 am
    • 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.

      March 27, 2012 at 10:14 am
      • 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!

        March 27, 2012 at 1:09 pm
        • 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.

          March 27, 2012 at 1:22 pm
          • Pushkar says:

            Hi, Thanks a lot for your replies. I set the environment variables just before I saw your reply. It is working flawlessly now. Cheers!

            March 27, 2012 at 3:53 pm
          • David says:

            Lifesaver!

            January 3, 2013 at 6:14 pm
  • 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

    March 31, 2012 at 1:47 pm
  • 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

    March 31, 2012 at 1:50 pm
  • Computer support says:

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

    April 2, 2012 at 9:27 am
  • 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.

    May 14, 2012 at 5:07 pm
    • newlife007 says:

      Save the file in c:\apache24\htdocs.

      May 14, 2012 at 5:22 pm
  • 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!

    June 11, 2012 at 4:06 pm
  • 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

    July 2, 2012 at 7:18 pm
    • 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.

      July 3, 2012 at 4:49 pm
      • 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.

        July 3, 2012 at 10:07 pm
        • 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.

          July 4, 2012 at 1:18 am
  • 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?

    July 5, 2012 at 12:10 am
    • 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.

      July 5, 2012 at 2:24 am
      • 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

        December 6, 2012 at 8:55 pm
  • 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. :)

    July 12, 2012 at 12:59 am
    • 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.

      July 12, 2012 at 2:32 am
  • Herz says:

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

    FAIL

    July 12, 2012 at 1:14 am
  • Pratyush Nalam says:

    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

    July 19, 2012 at 3:13 pm
    • 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.

      July 19, 2012 at 8:55 pm
  • 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?

    August 24, 2012 at 7:28 pm
    • 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?

      August 24, 2012 at 8:53 pm
  • 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!

    August 25, 2012 at 10:01 am
  • I says:

    extension_dir = “ext” – don’t work

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

    September 10, 2012 at 7:26 am
    • 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.

      September 10, 2012 at 11:03 am
  • 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

    September 30, 2012 at 1:45 pm
    • 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.

      September 30, 2012 at 2:00 pm
  • 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

    September 30, 2012 at 2:17 pm
    • 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.

      September 30, 2012 at 2:37 pm
      • Yoga says:

        doesn’t work for me.
        I think it should be

        October 19, 2012 at 9:42 am
  • 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

    September 30, 2012 at 4:02 pm
    • newlife007 says:

      Browser is short for Internet Browser, like Internet Explorer, Google Chrome and Mozilla Firefox.

      September 30, 2012 at 4:26 pm
      • Albert Christopher Daniot says:

        everytime i use my internet browser, it says “unable to connect” … just for this “localhost/info.php”

        October 1, 2012 at 1:32 am
  • 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

    October 1, 2012 at 4:01 pm
    • 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.

      October 1, 2012 at 4:38 pm
      • 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.

        October 1, 2012 at 5:37 pm
        • Albert Christopher Daniot says:

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

          October 2, 2012 at 12:20 am
          • 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?

            October 2, 2012 at 12:54 am
  • 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”

    October 2, 2012 at 2:47 am
    • newlife007 says:

      Settings look good for php but you have the IE 10 Do not Trace and it is probably the issue. Change it to

      You need to have the IfModule directives around the settings. Here is a good reference for that setting.i http://www.apachelounge.com/viewtopc.php?p=22655

      October 2, 2012 at 12:14 pm
  • 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

    October 8, 2012 at 10:49 am
    • 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.

      October 8, 2012 at 11:15 am
      • Paul Rowley says:

        Sorry the 2.2 was a desperate attempt I didn’t realise I had pasted into this thread. The file is most definitely there :( I give up just can’t get it to work.

        Thanks for your help.

        October 8, 2012 at 3:17 pm
        • newlife007 says:

          Is c:\apache24 and c:\php in the PATH environment variable for the system? And after it was added did you reboot?

          October 8, 2012 at 6:04 pm
          • Paul Rowley says:

            Both :-(

            October 8, 2012 at 8:50 pm
  • 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.

    October 11, 2012 at 2:41 pm
    • 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.

      October 19, 2012 at 9:40 am
      • 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.

        October 19, 2012 at 11:47 am
  • xiechaofeng says:

    think you

    October 27, 2012 at 12:24 am
  • pera says:

    Thanks man, your article was helpful.

    November 15, 2012 at 9:03 am
    • 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

      November 16, 2012 at 10:55 am
      • 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.

        November 16, 2012 at 11:06 am
        • 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.

          November 16, 2012 at 12:59 pm
  • Joe says:

    Thanks, worked very well for me.

    November 21, 2012 at 7:54 pm
  • 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

    December 5, 2012 at 3:16 pm
    • 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.

      December 5, 2012 at 3:19 pm
  • abhinab saikia says:

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

    December 5, 2012 at 4:03 pm
  • 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.

    December 7, 2012 at 12:07 am
  • abhinabsaikia says:

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

    December 9, 2012 at 5:14 pm
    • 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.

      December 9, 2012 at 6:35 pm
  • 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

    December 10, 2012 at 7:37 pm
    • 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.

      December 11, 2012 at 6:48 pm
      • 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 :(

        December 11, 2012 at 9:35 pm
  • 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?

    December 12, 2012 at 6:22 pm
    • 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.

      December 12, 2012 at 6:59 pm
      • 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!

        December 14, 2012 at 3:35 pm
  • 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

    December 21, 2012 at 8:32 am
  • 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.

    December 21, 2012 at 9:59 am
    • 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.

      December 21, 2012 at 12:02 pm
  • 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.

    December 27, 2012 at 3:30 am
    • 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.

      December 27, 2012 at 3:33 pm
      • BigDuy01 says:

        I downloaded the
        apache 2.4.3 (httpd-2.4.3-win32.zip)
        PHP5.5 vc9 X86 Non Thread Save ZIP file
        php5apache2_4.dll-php-5.4-win32.zip (given from the comment)

        I check the version for the php is shows php 5.4.10

        I get multiple dll when i unzip, i get fouder from PHP5.4.0 to PHP5.4.9. I try every php5apache2_4.dll and I get the same error for all.

        Please help. I’m very new at this.

        Thanks! ahead of time.

        December 28, 2012 at 3:27 am
  • 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.

    December 27, 2012 at 9:51 am
    • 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.

      December 27, 2012 at 3:04 pm
  • kou says:

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

    January 4, 2013 at 4:02 am
  • 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.

    January 17, 2013 at 12:54 pm
    • 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.

      January 17, 2013 at 1:00 pm
  • Matthew Degnan says:

    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!

    January 26, 2013 at 7:45 pm
    • newlife007 says:

      I am glad the guide worked for you. I try to revise it when they make changes.

      January 26, 2013 at 10:18 pm
  • 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?

    February 21, 2013 at 8:01 pm
    • 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?

      February 21, 2013 at 8:27 pm
  • 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

    February 28, 2013 at 2:33 pm
    • 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?

      February 28, 2013 at 2:43 pm
      • 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

        February 28, 2013 at 2:53 pm
        • 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.

          February 28, 2013 at 2:56 pm
          • 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.

            March 1, 2013 at 6:16 am
          • 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

            March 1, 2013 at 11:01 am
  • dougie says:

    they are as you have written

    March 1, 2013 at 11:12 am
    • 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

      March 1, 2013 at 12:24 pm
  • dougie says:

    this is the mysql_connect.php code

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

    March 1, 2013 at 12:37 pm
  • dougie says:

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

    March 1, 2013 at 2:37 pm
    • 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

      March 1, 2013 at 3:54 pm
  • 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…

    March 10, 2013 at 2:04 am
  • 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…

    March 10, 2013 at 3:05 am
  • 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…

    March 10, 2013 at 4:14 pm
  • Andy Sabo says:

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

    March 15, 2013 at 2:13 am
    • 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.

      March 15, 2013 at 12:09 pm
  • 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?

    March 19, 2013 at 12:13 pm
  • 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)

    April 12, 2013 at 11:30 am
    • 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.

      April 12, 2013 at 11:35 am
      • 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^^

        April 12, 2013 at 11:45 am
        • newlife007 says:

          no problem, things change continually and it is hard to keep up.

          April 12, 2013 at 2:06 pm
  • 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

    April 18, 2013 at 2:06 pm
    • newlife007 says:

      Did you make sure to add c:\php to the path environment variable on your system and reboot? otherwise run c:\php\php -m

      April 18, 2013 at 9:55 pm
  • Roy says:

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

    April 28, 2013 at 2:09 am
  • Pratyush Nalam says:

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

    April 28, 2013 at 6:43 am
    • 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.

      April 28, 2013 at 11:18 am
  • 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.

    May 18, 2013 at 1:33 pm
    • newlife007 says:

      There should not be a password on the file. Try downloading it again.

      May 18, 2013 at 7:23 pm
  • Pratyush Nalam says:

    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

    May 20, 2013 at 11:54 am

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

*

Switch to our mobile site