search
top

How install Apache 2.4 PHP 5.4.16 and MariaDB 5.5.31 on Windows 7

As a followup to my post on How install Apache 2.4 PHP 5.4 and MySQL 5.5.21 on Windows 7, I decided to install the latest Apache 2.4 / PHP 5.4.16 and MariaDB 5.5 with PhPMyAdmin. The difference is using MariaDB and PHP 5.4.16.

Apache 2.4 Install

First download Apache 2.4.4 from http://www.apachelounge.com/download/ (httpd-2.4.4-win32-ssl_0.9.8.zip) Apache 2.4.4-win32-ssl_0.9.8.zip.

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

PHP 5.4.16

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

PHP 5.4.10 and newer configuration

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

Note: If you receive and error that MSVRC100.dll is missing you will need to download and install Visual C++ 2010 x86 Runtime. You can retrieve that from http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=5555.

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
extension=php_mbstring.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.

MariaDB
Download and install mariadb-5.5.31-winx64.msi. Change installation directory to C:\MariaDB 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.5.8.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 / MariaDB installation running and ready for you to start developing !!!

7 Responses to “How install Apache 2.4 PHP 5.4.16 and MariaDB 5.5.31 on Windows 7”

  1. Miguel Ángel Salazar Castillo says:

    Thank you.

  2. Sybil says:

    Hurrah! In the end I got a blog from where I can truly take valuable data concerning my study and knowledge.

  3. Vid says:

    how to input server name variable ?? can u explain in detail ?? I am very new to this and I am finding difficulty in set up

    • newlife007 says:

      Edit the c:\apache24\conf\httpd.conf file and find the line #ServerName http://www.example.com:80 Remove the # and the change the http://www.example.com:80 to the name of the server you want. Save the file and restart Apache.

    • Vid says:

      apache services are not starting but when I run this command c:\apache24\bin\httpd -k instal I don’t get any error please help me I am trying to install apache server as I want to run PHP program from few days and I am finding it difficult.
      It will really helpful if someone can solve my problem

      • newlife007 says:

        Just running the c:\apache24\bin\httpd -k install does not start Apache. It registers the Apache service and sets it to Automatic. If you reboot your system it should start. You can also go into Control Panel > Administrative Tools > Services and find the Apache24 service, click on it click on the start icon in the toolbar.

  4. Bernhard says:

    Hi there,
    I used your tut as base for installation of Apache 2.4, PHP 7.0.9 and MariaDB 10.1.16 (all x64) on a Win7 System … only few modifications necessary. Thanks for your great work!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top