Install Mysql Module Php Windows Apache

Active2 years, 10 months ago
  1. Steps to Install PHP 7.0, Apache 2.4.17, & MySQL 5.6 on Ubuntu 15.10, 15.04 & 14.04 LTS operating systems. Above command will list all available PHP7 modules for.
  2. PHP is a friend of MySQL, you can do a lot with both PHP and MySQL programs starting from applications to websites. Read Article: Windows Events ID - Part 3 Follow the steps below to install PHP 7 in Windows.

Downloading PHP is the second part of manually install apache php mysql windows guide. PHP has started developing x64 bit build for windows os lately. We can go for x32 bit or x64 bit windows built. Here I am going to show you how to install Apache 2.4 and PHP 7 in windows. Httpd-php.php.html LoadModule php7_module. Install Apache, PHP, PostgreSQL, MySQL.

Its my first time working with Apache,PHP,MySql. I downloaded and installed the latest package of these 3. Now I checked with apache and the index.html works. Now I replaced the index.html with some php script to check if my php works or not. When opened the html page again I see the php code directly. It seems it does not work. following is how my php code looks like.

when I open my index.php , I see the above code itself. Can anybody let me know whats wrong and how can i fix it?

Surjya Narayana PadhiSurjya Narayana Padhi
3,53522 gold badges66 silver badges107 bronze badges

5 Answers

Check your apache httpd.conf file for some commented out code that looks like this

and further down the file, this..

Mike VormwaldMike Vormwald

it seems there is some problem in the installation. use WAMP as stefan and dessus or XAMPP. i recomand u to use XAMPP its bundled with APACHE, MYSQL, File Zilla Server, Mercury for mail. Easy to Install and Use . http://www.apachefriends.org/en/xampp.html

Bhavesh GanganiBhavesh Gangani
2,4174 gold badges32 silver badges62 bronze badges

Another vote for WampServer. Once you have a working server, it's then easier to poke around with configurations files and then learn Apache/PHP configuration that way.

Martin BeanMartin Bean
26.2k20 gold badges98 silver badges173 bronze badges

use wamp! it's easy and fast :)

personally, i use an old version from 2007, 1.7.4, it can be found here: http://sourceforge.net/projects/wampserver/files%2FWAMP5/

the good thing about using an old version is that your code will work on old machines, and many servers out there have old versions of php and mysql.

the bad thing about using an old version is that your code might not work on new machines, and some machines out there have new versions of php and mysql.

davogotlanddavogotland
2,4591 gold badge11 silver badges18 bronze badges

Step By Step Process to Setup Apaache,PHP,Mysql,phpMyAdmin and XDebug.

1)How to install Apache

2)Setup PHP for Apache

3)Install & Configure MySQL to use with PHP

4)Setup XDebug for Debugging

5)phpMyAdmin

Note:In this tutorial my Server Folder is located on F:Server

How to install Apache

1)There are two ways to install apache either install the old version of apache httpd (Compatible with Windows XP) from httpd.apache.org/download.cgi or get the latest apache build zip from www.apachelounge.com/download/ .

2)I will show how to configure apache from the zip version downloaded from apachelounge.com/download/ .

3)Click on Additional + VC9 on the left of the page.

4)Download the 2.4.x zip build with OpenSSL 0.9.8.

5)Create a folder with a name Server on location where .

6)My Location is F:Server

7)Extract the Apache24 from apache zip to the Server folder.

8)Now Goto config folder in Apache and open httpd.config in any text editor.

9)Find(Ctrl + F) and replace each and every instance of 'c:/Apache24' and change it to your apache location in my case its f:/Server/Apaache24.

ServerRoot 'c:/Apache24' with ServerRoot 'f:/Server/Apache24'

DocumentRoot 'c:/Apache24/htdocs' with DocumentRoot 'f:/Server/Apache24/htdocs'

with

ScriptAlias /cgi-bin/ 'c:/Apache24/cgi-bin/' with ScriptAlias /cgi-bin/ 'f:/Server/Apache24/cgi-bin/'

with

8)Now run the Command Prompt (with Administrator Rights) .

9)On Command Prompt go to the location Server/Apache24/bin .

10)Inside the Bin folder type 'httpd -k install' to install the Apache service and then press Enter.

11)To start the Apache Server simply type in 'httpd -k start' and then press Enter.

12)Restart Your Computer

13)Now Open the Bin folder and double click on the ApacheMonitor.exe and Start Apache

14)Now Goto localhost if you see page 'It Works' then Apache is sucessfully installed on you computer.

If you see a page that says 'It works!' then the Apache server has been installed successfully.

Setup PHP for Apache

1)Goto windows.php.net/download/ download the php-5.4.x-Win32-VC9-x86.zip.

2)Create a folder named php inside Server folder.

3)Extract all files from php-5.4.x-Win32-VC9-x86.zip to php folder in the Server.

4)Now Goto config folder in Apache and open httpd.config in any text editor.

5)Find(Ctrl + F) the LoadModule scroll down until last LoadModule and Paste the following

LoadModule php5_module 'f:/Server/php/php5apache2_4.dll'.

6) Find(Ctrl + F) the AddType scroll down until last AddType and Paste the following

AddType application/x-httpd-php .php .

7)Add the PHP location to the end of the httpd.conf file. For example, at the end of the file, add the following: PHPIniDir 'Your PHP Location'.

localhost/info.php

8)In the php folder rename the php.ini-development to php.ini and open it in Text Editor.

9)Find(Ctrl + F) the display_errors, and make sure the value is set to On.

10) Find(Ctrl + F) the extension_dir = './' and change it to extension_dir = 'F:Serverphpext' .

11)Restart Apache Server.

12)Create a file 'phpinfo.php' in htdocs folder in Apache with follwoing content:

13)Goto localhost/phpinfo.php

extension_dir = './'

14)Right Click MyComputer Click Propertes

15)Click Environment Variables

16)Add Your php folder location at the end of the path

17)Restart Your Computer.

Install & Configure MySQL to use with PHP

1)Goto dev.mysql.com/downloads/mysql/ download the zip or installer version.

2)Install MySQL

3)Click Next

4)Select Complete & click Next

5)Click Finsh

6)Click Standard Configuration

7)Click Next

8)Enter the password for mySQL

9)Goto MySQL Command Line and enter the password.

12)Open the php.ini file and find the line: ;extension=php_mysql.dll remove the semi-colon.

and find the line: ;extension=php_mysql.dll

phpMyAdmin

1)Goto config folder in Apache and open httpd.config in any text editor.

2) Find(Ctrl + F) the line DirectoryIndex index.html add index.php.

3)Open php.ini file in the Server Folder and Uncomment the mbstring and mysqli extension.

3)Goto phpmyadmin.net/ Download the latest phpMyAdmin-4.0.8-english.zip.

4)Extract it to phpMyAdmin folder in htdocs.

5)Restart the Apache Server.

6)Goto localhost/phpMyAdmin/

Setup XDebug for Debugging

1)Goto http://xdebug.org/download.php from your browser and download the

php_xdebug-2.x.x-5.4-vc9 Thread Safe 32 bit version.

2)Copy and Paste it to the extension folder in the php. Hp compaq d530 sff driver xp.

3)Copy & Paste the following line of code at the end of php.ini file .

[XDebug]

;; Only Zend OR (!) XDebug

zend_extension='Your Location of Xdebug'

xdebug.remote_enable=true

xdebug.remote_host=localhost

xdebug.remote_port=10000

xdebug.remote_handler=dbgp

4)Restart Apache Server.

5)Goto to localhost/phpinfo.php scroll down to see if xDebug is installed

falsarella
10.1k7 gold badges55 silver badges96 bronze badges
RushikeshRushikesh

Not the answer you're looking for? Browse other questions tagged phpwindowsapache or ask your own question.

Active5 months ago

How do I install Apache with PHP support and the MySQL server on Windows without using any ready-to-use packages like WAMPServer or XAMPP ?

user256743

2 Answers

First, I recommend you read the Platform Specific Notes of Apache for Windows - it explains some Windows-specific features like running as a service that you don't have on other OSes and you probably have never used before.

As mentioned in these platform specific notes, Apache doesn't provide binaries for Windows, however they have links to several third-party sites that provide binaries, for example Apache Lounge.

From that website, we can download either the 32-Bit version (win32) or the 64-Bit one (Win64) - if your OS is 64-Bit you should always try to install 64-Bit versions of software, but note that you'll need to use 64-Bit modules as well, that means if you only have a 32-Bit module then download the 32-Bit Apache.

Here's the version that I used when writing this : Apache 2.4.10 Win64. The latest version when this answer was last updated: Apache 2.4.38 Win64 (look at the edit date at the bottom of the post).

Once downloaded, just extract the Apache24 folder to the root of your hard drive, so that you have a path like C:Apache24bin.

Open a command line window (Windows+R and type cmd then press Enter), change directory into C:Apache24bin and run httpd.exe, normally it shouldn't print any errors.

If you get an error dialog stating that MSVCR110.dll is missing on your system, you'll need to install the Visual C++ Redistributable for Visual Studio 2012 - as always, when prompted, select the appropriate bit-version : vcredist_x86.exe for 32-Bit systems and vcredist_x64.exe for 64-Bit ones.

If you get an error saying that it can't bind to port 80, check if another application uses that port - also Skype is known to use ports 80 and 443 by default; uncheck 'Use port 80 and 443 as alternatives for incoming connections' in its advanced connection settings, restart Skype to apply the changes, and then you should be able to start Apache without issues.

A warning like Could not reliably determine the server's fully qualified domain name can be ignored for now.

Windows Firewall may prompt you to allow Apache to communicate on specific networks, I recommend you use the default settings : allow it on home and work networks, but not on public/untrusted networks.

Then, open a browser and browse to http://localhost, if you see a page saying It works ! then it means your Apache installation is working.

You can now stop the currently running Apache by pressing Ctrl+C in the command prompt.

If you got a warning about not being able to determine the system's fully qualified domain name, fix it by editing C:Apache24confhttpd.conf and editing the ServerName variable (it should be already there in a comment, just uncomment it and change it) :

Replace <yourhostname> with either the system's host name or localhost.

Finally, if you want to run the server automatically when the system starts (even if nobody logs in), you'll need to run it as a service - in a new elevated (as an administrator) command prompt, type :

Install Mysql Module Php Windows Apache

That's it, now you have a new service in Services (Windows+R then type 'services.msc' then press Enter) named 'Apache2.4' that you can control just like any other Windows service.

Restricting Apache access to localhost only - optional

If you're setting this up for development purposes you want to make sure that no one except you can access it, your firewall should already take care of that but let's add another layer of security to it by telling Apache to accept requests from the local machine only.

Open Apache's configuration file C:Apache24confhttpd.conf, search for the default directory block <Directory 'c:/Apache24/htdocs'>.

At the end if it, there should be a line Require all granted, this means that anyone can access this server. Let's make that Require local which only allows access from the local machine.

Also, you can tell Apache to only bind to the loopback interface, that way even if both your firewall and the access control directives mentioned above fail, the server still won't be open to the whole internet.

For this, locate the Listen directive (by default it's set to 80) and change it to the following :

The first line is self explanatory, the second one is the first one's IPv6 equivalent, the brackets are used in the IPv6 notation to separate the address and the port.

Save the file, if you're already running the server then restart it in order to take our changes into account, and now only localhost has access, everyone else will get a 403 Forbidden.

I suggest you read the official PHP documentation about installing it on Windows systems.

Download the latest PHP binaries from the official PHP for Windows download page, choose the thread-safe version that matches your Apache installation's bit-version (x86 for 32-Bit, x64 for 64-Bit).

The non thread-safe version is only when running as a CGI binary - more info here.

The version I used is this : PHP 5.6.2 VC11 x64 Thread Safe. The latest version when this answer was last updated: PHP 7.3.3 VC15 x64 Thread Safe (look at the edit date at the bottom of the post).

Create an empty PHP folder at the root of your hard drive, and extract the previously downloaded archive there, you should have a path like C:PHPext, otherwise you did something wrong.

In C:PHP, rename the php.ini-production or php.ini-development (depending on what you want) to php.ini.

Open that php.ini file, search for extension_dir = 'ext' and uncomment that line (remove the first ;). This sets the default extension dir to ext (which resolves to C:PHPext and avoids having to prepend ext/ to all extension's paths manually like in previous versions of this post.

Now configure Apache to use that PHP, by editing C:Apache24confhttpd.conf - after all the LoadModule lines, add the following :

(The follow is for PHP 7 only)

(The following is for PHP 5 only)

Now try to start Apache manually by opening a command prompt in C:Apache24bin and running httpd.exe - if you see no errors, it means your configuration file is valid and PHP is most likely working.

You can test your PHP installation by creating a file like info.php with <?php phpinfo(); inside and going to http://localhost/info.php - you should see quite a bit of info about your system and your PHP installation and all its modules. If you get something else like an 'Internal server error' that means something's wrong.

You can now kill your current Apache process (Ctrl+C in the console) and start the service - the following part doesn't interact with Apache and can be done with the server already started.

Composer - optional

Composer is a tool for dependency management in PHP, like a package manager. It allows to easily install PHP packages and even entire frameworks.

Composer requires the PHP OpenSSL extension to be enabled, so let's enable it in C:PHPphp.ini.

Use your text editor's search function to search for php_openssl.dll, there should already be a commented line for it, just uncomment that line.

Now download Composer's Windows installer from their download page - or just use this direct link.

Follow the instructions, when prompted for the path to PHP, browse to C:PHP and select php.exe.

That's it, Composer is now installed system-wide and can be used from anywhere - you can try it out, just open a new command prompt (you can't use one that's already open since it needs to read the new PATH variable set by Composer's installer) and type composer.

You should get a nice ASCII-art logo and something like this :

PHP MySQL extensions - optional

If you want to access your MySQL database from PHP, you'll need to enable extensions that allow you to do so, like php_mysqli or php_pdo_mysql - I recommend enabling them both.

Open PHP's configuration file C:PHPphp.ini in your text editor and search for php_mysqli or php_pdo_mysql - they should already be there, uncomment them.

Done, now you can access any MySQL database using either mysqli or PDO.

On the MySQL Installer download page download the web installer mysql-installer-web-community-xxxxx.msi.

I used mysql-installer-web-community-5.6.21.1.msi. The latest version when this answer was last updated: mysql-installer-web-community-8.0.15.0.msi (look at the edit date at the bottom of the post).

Install Apache On Windows 10

The installer will automatically install the appropriate version (32-Bit or 64-Bit) depending on your system, even though MySQL's bit version doesn't have to match Apache's and PHP's one but it's still beneficial to use the 64-bit version of your system supports it to take advantage of more than 3 GB of RAM, that's quite important as database servers tend to use a lot of RAM.

Follow the steps in the installer, if you're installing this for development then the Developer default will be your best option, it'll also install MySQL Workbench which is a native GUI client, thus avoiding you having to install slow web-based tools such as PHPMyAdmin if you aren't comfortable with using the command line client.

Once everything is installed the installer will ask your for some basic configuration values, I recommend disabling 'Open firewall port for network access' unless you want to access the database from another machine on the network.

Set the root password - if it's only for development purposes and your firewall blocks incoming connections from the network then a strong password isn't necessary.

Finally, you can disable the useless MySQL Notifier by right-clicking the tray icon, going into Actions -> Options, then untick the Run at Windows Startup checkbox and apply. That'll save you a few MBs of RAM and avoid slowing your machine down when it's booting.

And that's it, you now have a fully functional WAMP server that runs as a service and doesn't depend on any user (accessible even if no one is logged in).

Note that I have no idea about the security of this, for development purposes I'd say this is pretty safe since your firewall should block incoming connections for both Apache (port 80 and or 443) and MySQL (port 3306).

This was tested on a Windows 7 installation, it should also work just fine on Vista, Windows 8 and possibly Windows Server 2008/2012 - feel free to comment and/or downvote if that's not the case.

user256743

The instructions in the above answer work perfectly as of July 2017, however, if you wish to use PHP 7, you must add the following lines to C:Apache24confhttpd.conf, instead of the ones in that answer (which work only for PHP 5) [Add the following after all the LoadModule lines]:

Ensure that all paths are correct. If you don't have php7apache2_4.dll in your PHP directory, you probably downloaded the wrong package.

rahuldottechrahuldottech
4,0405 gold badges27 silver badges53 bronze badges

Apache Php Mysql Package

protected by MokubaiJul 2 '16 at 21:59

Installing Mysql Module Php Windows Apache

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?