If you are planning to install Apache, PHP, and MySQL on Windows 11 machine, then first, you have to decide as to which version of each application will be installed.
- Apache 2.4.54
- MySQL 8.0.31
- PHP 8.2
You can download the required installer via links given below:
- Download Apache for Windows: https://www.apachelounge.com/download/
- Download PHP for Windows: https://www.php.net/downloads.php
- Download MySQL for Windows: https://www.microsoft.com/en-in/download/details.aspx?id=48145
How to install Apache, PHP, and MYSQL on Windows 11 Machine
First, we have to decide as to which version of each application will be installed.
- Apache 2.4.54
- MySQL 8.0.31
- PHP 8.2
You can download the required installer via links given below:
Apache 2.4.54 Installation on Windows 11 Pro 64 bit:
https://httpd.apache.org/download.cgi#apache24
- Install the latestC++ Redistributable Visual Studio 2019:
https://www.microsoft.com/en-in/download/details.aspx?id=48145
- Download Apache 2.4.54
- Download Apache files and unzip them (archive httpd-2.4.54-win64-VC14.zip) to the C:\Apache24\ directory:
- After unzipping, go to the folder c:\Apache24\conf\ and open the httpd.conf file by any text editor.
- Change below line in this file:
#ServerName www.example.com:80
ServerName localhost
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
AllowOverride None
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
AllowOverride All
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule rewrite_module modules/mod_rewrite.so
- Register Apache service:
If you see this page, it means that your Apache installation has been successfully done.
You can modify index page code or upload your files like the given example below.
PHP Installation on Windows11:
https://www.php.net/downloads.php
Download zip file
- Rename php-ini-development.ini to php.ini
- Add PHP in a system environment variable.
C:\>setx path “%PATH%, C:\php82” /M
- Again, open the file c:\Apache24\conf\httpd.conf and append it with lines:
PHPIniDir “C:/PHP82”
- AddHandler application/x-httpd-php .php
LoadModule php8_module “C:/PHP82/php8apache2_4.dll”
- Restart Apache services.
MySQL Installation on Windows 11 Pro 64 bit:
- Download MySQL installer and click on Run.
- https://www.microsoft.com/en-in/download/details.aspx?id=48145
- Select Server Only and click on Next.
- It will ask you to install Visual Studio 2019 on your system.
- Click on the Execute button.
- Select License Agreement and then click on Next.
- Click on Close
- Click Next
- Click on Execute button
- Click Next button
- Select Server Computer
- Put root user password. Confirm password and Click on Next.
- Click on Next button
- Click on Execute Button
- Click on Finish button
That’s it! You’re done 🙂
Planning to install Apache, PHP, and MySQL? Choose VPS and pick any plan from https://www.znetlive.com/vps-hosting-windows/
Update: This post has been updated with latest information on 6th Jan, 2023.
Read details in a report by Forrester.
Services ZNetLive offers:
If you have any doubt regarding this write-up or need to know more about the installation, drop comments below and get in touch.
Hello I’m getting this error please help
httpd: Syntax error on line 541 of C:/Apache24/conf/httpd.conf: Cannot load C:/PHP74/php7apache2_4.dll into server: The specified module could not be found.
Hi Yvonne,
Thanks for reaching out.
Please verify your PHP/Apache versions. Make sure you are using 64 bit versions.
Thanks.
I could not find that particular version.
I found other version.
However, the dll files are different.
Therefore, the settings do not work.
kindly assist of what is available from the official website.
Thanks a lot.
Hi Johnny,
This blog is for specific version only. We will soon share an article on other versions as well.
will mysql installer community 5.7.13.0 version fit with this combination or not?
Yes, this combination will work with mysql installer community 5.7.13.0 version too. Are you facing any issue during installation of Msyql ?
any problem behind to give random port number option in installation process
No, you can give any port no. during installation.
Make sure that port no. is not used by any process.
I have followed up as per your blog, but in the case of php configuration, I didn’t found ini file to configure. instead of that I found 2 files. php-ini-development, php-ini-production. On which file I shoulld have to modify?
Hello Lijin,
You have to rename php-ini-development or php-ini-production file into php.ini and use it.
Hi..
will you please configure for me through the team-viewer
Hello sir i am having a problem using php with apache24, though i have followed the instructions above, i have even add the code u recommended at the bottom of the apache24 conf. Pls help, have attached a photo to show the prob
https://uploads.disquscdn.com/images/3e1d766587bbd792168ab93be378cd9640dcabc7c433f30dc4dba470d73e966e.jpg
Before I could install MySQL, I had to install Python 3.4. Sometime between installing Python and MySQL, I lost my ability to start the Apache server. Apache was working fine after installing PHP. Any thoughts?
Ok, I think I found my problem. It was the PHP. I did not download the “Thread Safe” version of PHP and then I copied and pasted your text of the httpd.conf file and did not remove the quotation marks. Fixed those two things and it is connected again
Hello B Baker,
We’re glad to know that you found this article helpful to get solution of your problem.
Hows about updating and correcting the original then so we don’t all have to waste an entire day on all these typos?
If you are using updated versions of Apache / PHP / MYSQL, then you have to wait for our updated blog post. We will include all latest version and steps in this soon.
I have applied all the steps as you mention for installation of apache, however it still not work, on checking with httpd -S command it says Server Root must be a valid directory, so how to create Server root directory? Can you guide?
Hi Sunil,
Please use default root directory of Apache and then try.
I downloaded the C++ Redistributable Visual Studio and installed it. Also downloaded the Apache 2.4.25 Win64 file, unzipped it to C:/Apache24 and made the changes to the httpd.conf file. I installed it as a windows service successfully, but when I tried to open the http://localhost/index.html file, I get a message that localhost refused to connect. Is there something I am missing?
Never mind, I had to start the windows service.
Hey Bob,
If you are using latest version of Apache 2.4.25 then you have to use latest version of Visual Studio 2015, which is required for Apache version 2.4.25.
As you state next, you have to start the service. I hope it helps others to see this means
• cd Apache24bin
• httpd.exe -k install
• httpd.exe -k start
..it is that third line that is missing in the OP’s instructions. (And by the way, the config file httpd.conf is in C:Apache24conf , not C:Apache24conf 🙂
https://uploads.disquscdn.com/images/8974846838d4b5470a26889ae7d3223d53e946b9e0a4801ffe570116f0c86cb4.png
sir this error occured when I did the changes in the code of httpd.conf file in Apache24.What could be the mistake .Please reply me soon with the solution to remove the error.
thank you
Yes, your configuration is not correct and that’s why you’re facing this issue. Would you please confirm that you are using same Apache 2.4.16 version?
Hey I just installed Apache 2.4.27 along with php7.1. Now the .html file in htdocs works fine but .php does not, i tried running phpinfo() in a simple php file and it did not load the proper page? Any help is greatly appreciated.
Hi Kazim,
If you are using latest versions of Apache then we suggest you to use below versions of other components-
· Apache 2.4.25 VC14
· MySQL 5.7
· PHP 7 and
· Microsoft Visual C++ 2015
This may be too late but rebooting my pc fixed the issue. Usually after installations and I’m sure I followed instructions carefully, a reboot fixes most issues.
Hi Eudaimonia,
Reboot is not required to complete this process but there might be an issue with any patch which was causing issue with C++ Redistributable Visual Studio and after rebooting, issue got fixed.
It seems you did some wrong changes in the file. Please share the exact error which is coming, so we can guide you accordingly.
Before I start this.. does this work with a VS2015 installation?
Hi BroVic,
You can install VS2015 on server but only for development purpose. It’s compatible with-
· Apache 2.4.25 VC14
· MySQL 5.7
· PHP 7 and
· Microsoft Visual C++ 2015
Run-time is required for running Apache in Windows Environment.
Download and install Microsoft Visual C++ VS 2015 x64 from here- https://www.microsoft.com/en-in/download/details.aspx?id=48145
Thanks.
Had a question about this phrase
Configure your ini file:
extension_dir = “C:phpext” [Set extension directory]
You can enable other extensions as per your requirement like: Curl, GD, MySQL.
Where is this located so i can configure the ini filoe like you are requesting ? Any tips?
This is located in C:PHPphp.ini search for MYSQL extension=php_mysql.dll AND un-comment those extensions you wish to activate.
You ALSO have to rename php-ini-development or php-ini-production file (in c:php ) into php.ini. God almighty did anyone actually reread what they wrote in the original article here?
Did you install the MySQL package from the community or the web community? There are two different options and I’m not sure which one to download.
Hi Jarid,
Yes, we installed MySQL package from community version.
It’s saying I need Python 3.4 installed. Did you download the larger or smaller package?
No, we haven’t used any Python package.
Thanks for Reply i have done the same it is working, but i also want to attach web domain i have registered with godaddy, i have one laptop only with windows 10 professional, is it necessary that i should buy another laptop or desktop and install windows server or linux server?
Sunil, if you have any static IP on your system where you configured Apache then you can point your domain on static IP and it will start working. You can upload data in default home directory of Apache.
Configuration File (php.ini) Path C:WINDOWS
Loaded Configuration File (none)
anybody know how to fix this?
In the blog, we have mentioned to use C:PHP for PHP installation. You should try to reinstall PHP once.
Hello,
I am almost done configuring the above but, I do have confusion with following text:
Configure PHP as an Apache module:
Edit Apache configuration file and add below lines at the bottom of the file. C:Apache24Confhttpd.confLoadModule php5_module “c:/php/php5apache2_4.dll”
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir “C:/php”
I’m trying to replace the line “C:Apache24Confhttpd.confLoadModule php5_module “c:/php/php5apache2_4.dll”” with:
C:Apache24/conf/httpd.confLoadModule php7_module “c:/php/php7apache2_4.dll”
I’m using following software versions:
php-7.1.9-Win32-VC14-x64
httpd-2.4.27-win64-VC14
Can anyone tell where I am wrong?
Hi Tushar,
You must add the following lines to C:Apache24confhttpd.conf, Add the following after all the LoadModule lines:
LoadModule php7_module C:/PHP/php7apache2_4.dll
DirectoryIndex index.html index.php
AddHandler application/x-httpd-php .php
PHPIniDir “C:/PHP”
Also make sure you installed : Microsoft Visual C++ 2015.
I have installed Apache servers several times and I am fairly familiar with installation in an Ubuntu environment. When doing this I have had to install both a FTP and a SSH server. Do I have to do the same in Windows? How do I go about it if I do?
If you want to manage files via FTP, then yes you have to configure FTP Server. Also, remote desktop connection is by default available to access Windows system remotely but if you want to access via SSH then you need to configure it on your Windows Environment.
hello ZnetLive
After that all installed, how to start making project? can you help provide some examples or links to learn
thank you
I’m a beginner
Hello Antok, please check this link: http://httpd.apache.org/docs/current/platform/windows.html
Hope it’ll be helpful for you.
thanks for your attention
If we have xampp then we install apache. Is that a problem? apache will run fine or can’t run?
Antok, please elaborate your query. Because Apache is already included in XAMPP package.
I want to try to build without xampp, so php itself, apache itself, and mysql own. Is it possible?
Yes, all steps which are mentioned in this blog are without XAMPP package.
I tried to install using cmd(admin) but it told me “Can’t find path specified”. What should i do
The command you actually need is:
cd C:Apache24bin
The author seems to have forgot that windows isnt a mind reader, cd Apache24bin could be anywhere 🙂
Well guys, I am grateful, BUT I am glad you allowed comments because you really did not express a lot of care when you wrote these instructions. Sometimes careless instructions are worse than none at all. On this occasion, I’m just glad of the instructions. Thanks. To others, if something makes little or no sense, search these comments!
Hi, new to wordpress, watched a video on how to install wordpress, and learnt I would have to install: Apache, PHP and MySQL, I read your blog on how to install them but I really still don’t understand them well enough, would I install them separately or ……?, can you please explain more?. Thanks
You would have to install each separately.
Please do elaborate on what you couldn’t understand. Thanks.
I was saying if I want to install wordpress would I have to install them separately (i.e. Apache, MySQL….e.t.c) or they are preinstalled on my system already. Thanks.
No, by default, PHP, Apache and MySQL not installed on any OS. You have to install separately. After that, you can install any CMS like WordPress.
If you’re installing on your own computer, what you need to know is that each component does a different thing. (If you’re using WordPress on a remote server, like at a hosting company, you probably won’t need to install anything except WordPress, and maybe a database.) Apache is the engine that runs PHP, which is a scripting language for architecting web functions. To store content for your website, which PHP functions to access using the Apache engine, you need a database. There are a variety of different types of databases, but the widely used format is SQL. MySQL is a system for accessing SQL-formatted databases. MySQL is widely used by many companies and websites and supports many SQL statements, which are used to manage data. You can write PHP to access data via MySQL. You can also use PHPMyAdmin, a graphical user interface to manage data without needing to know SQL commands.
Why 32-bit and not 64? Something to do with ZNet?
If you want to go with 64 bit, then you can try.
If you have a browser, the html file in Apache24/htdocs is going to work anyway. The real test is running a php file.
Thank you for the guidance..
This is really helpful information
Great article
Iam requesting for a clarification about Apache installation the 4th bullet says “change the below line in this file”
Change with what?
Please help to clarify 🙂
You have to update below lines. If these lines are commented then uncomment it.
ServerName localhost
AllowOverride None
AllowOverride All
LoadModule rewrite_module modules/mod_rewrite.so
Thanks a lot for the clarification Apache now works!
One more question regarding adding a path for the php install
I went to Cont Panel>syst>Adv syst Settings>Env variables>syst variables
Do I have to add a new variable? If yes, with what variable name and what variable value?
Or, do I have to edit the PATH variable? If yes, with what variable name and what variable value?
Thanks again:)
Yes, you can add new variable name or edit in any existing variable.
Path will be in your PHP installation directory :
Like : C:\php
I have an issue with MySQL
It is asking for Current Root Password
What I fill in it?
Thank you for sharing.
hi, i finished the configuration
but however i am unable to load the page localhost/phpinfo
It gives me an error of url not found
if i go to the page localhost only it work fine
add the end of the http.conf file i added the following
line 538 – PHPIniDir “C:\php72”
line 539 – AddHandler application/x-httpd-php .php
line 540 – LoadModule php7_module “C:\php72/php7apache2_4.dll”
can you help please
Thanks
Hi Warren,
Try to start it from fresh. There might be some issue in the setup. Also, please verify whether the Apache services started or not.
Hope this helps.
Hello sir, I have configured apache well and its working fine on the local machine, but when I try to access the site using the public ip on the other machine, it says the site is not reachable
What could be the problem here?
Hi Pablo,
Please make sure that Port 80 is open in the firewall, which is running on the server where Apache is installed. You can check with the local administrator.