Example:
;c:php;c:apache24;c:apache24bin;
Save and reboot the system.
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.
If do not want Apache starting automatically at start-up/reboot:
Command line
Now lets check Apache settings by issuing the command, c:Apache24binhttpd -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:phpphp.ini-development to php.ini
Now let’s edit php.ini
Uncomment extension directory.
If you copy and paste changes to the httpd.conf from the screen
(LoadModule php5_module “c:/phpphp5apache2_4.dll”
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir “C:/php”)
, compare the existing quotes used in httpd.conf to what you pasted in. There is a difference between fancy quotes and regular quotes. Apache wont run if there are fancy quotes in the httpd.conf file.
i have followed the whole mentioned steps the same, and there is no error, but still localhost page can not be found through the browser.
Hi Save your info.php file in to C:Apache24htdocs
Just wanted to say thanks!
Everything worked perfectly – you the man!
Just thought i would add some thing to this nice tutorial……Some time in win 7 and win 10 in the Apache httpd you need to make this path the full. extension_dir = “ext” change to “C:php/ext” or in my case extension_dir = “C:php7/ext”
Hope this helps a few
exscuse me i ment in the PHP.ini my bad
Thanks for this article, working perfectly.
Thanks
Apparently several others have had the same problem. I have installed Apache24, PHP7 and MySQL (64-bit versions) in Windows 10 exactly per the instructions provided.
When DocumentRoot in httpd.conf is configured as C:apache24htdocs” info.php shows up perfectly. When DocumentRoot in httpd.conf is changed to another directory where all the website files exist, only the html files show up (for example, index.html for the website). However, info.php produces a blank screen. There is no error message, only a blank screen. (Note: Yes, I have a copy of the info.php file in DocumentRoot directory.)
Have spent “hours” on this. Any help will be appreciated. Thanks.
Have downloaded httpd-2.4.27-Win64-VC15 and php-7.1.9=nts-Win32-VC14-x64.
following your instructions
edit apache conf file with
LoadModule php5_module “c:/php/php5apache2_4.dll”
or
LoadModule php7_module “c:/php/php7apache2_4.dll”
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir “C:/php”
There is no file named php5apache2_4.dll in php5 download or php7apache2_4.dll in php7 download
Apache says cant locate module.
Hi,
I’m almost done with this setup. Thank you for this article with detailed steps.
I’ve installed Apache 2.4 server, PHP 5.6 and MySQL 5.5
I’m able to run the index.html file as localhost/index.html
I’m also able to run the PHP program through command prompt successfully.
But, when I try to execute the index.php file, I could see the code is displayed as a plain text instead of executing the PHP code.
Could you please help.
Thank you in advance!!
gracias sirvió y mucho
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Now we have files:
Run and install the vc_redist.x64.exe file, we will not return to it.
On the drive C create a directory Server; inside it create the bin directory (we will install Apache, PHP, and MySQL there) and data directory (our websites and databases will be located there).
We continue our preparations. In the data directory create two folders:
Unpack the Apache files (archive httpd-2.4.25-win64-VC14.zip) to the C:Serverbin directory (we are interested only in the Apache24 folder):
After unpacking, go to the c:ServerbinApache24conf folder and open the httpd.conf file with any text editor.
Replace
with
replace
with
replace
with
replace
with
replace
with
replace
with
and replace
with
Save and close the file. Apache configuration is complete!
Open a command prompt (it can be done by simultaneously pressing Win + X). Select ‘Windows PowerShell (admin)’:
Copy-paste:
and press Enter.
If you see Firewall prompt, select ‘Allow access’.
Also copy-paste and run:
Afterwards in your bowser follow the link http://localhost/ you’ll see something like that
It means:
You can play with your new shiny web-server: add html-files to the folder, your server is running.
In the c:Serverbin folder unpack MySQL archive (the mysql-8.0.11-winx64.zip file). Rename it to mysql-8.0 (just for short).
Go inside the mysql-8.0 folder and create my.ini file. Open this file with any text editor. Copy-paste the following lines:
Save and close it.
Configuration is completed! But we have to initialize and install MySQL 8.0 on Windows. Open Command Prompt (as Admin) and run:
Once the process completed, inside the C:ServerdataDBdata folder automatically generated files should appear:
From now MySQL service will start automatically with every Windows boot.
If initialization failed and there is lack of files in the C:ServerdataDBdata folder and MySQL service failed to start, or in the C:ServerdataDBdata*.err file you got errors like that:
To cope the issue, remove all files from C:ServerdataDBdata folder, and to the my.ini file add the line:
After that initialize MySQL again:
Everyone who has issues with MySQL service, to fix it try to reset MySQL installatoin and install in from scratch:
1. Remove the service:
2. In the c:/Server/data/DB/data/ folder remove all files
3. Initialize and install the service:
If the problem persists please provide the content of the C:ServerdataDBdata*.err file.
In the c:Serverbin create new PHP folder and copy there the contents of php-7.1.1RC1-Win32-VC14-x64.zip.
Again open the c:ServerbinApache24confhttpd.conf file and append it with lines:
And restart Apache:
In the c:Serverdatahtdocs folder create i.php file and copy to there:
In a browser open the http://localhost/i.php address. If you see something like this, it means PHP works:
In the c:ServerbinPHP folder rename php.ini-development file to php.ini. Open it with a text editor. Find the string
and replace it with
Now find the group of strings:
and replace it with
Now uncomment this group of strings:
They should look like:
Save the file and restart Apache.
To the c:Serverdatahtdocs folder copy the content of phpMyAdmin-4.6.5.2-all-languages.zip. Rename phpMyAdmin-4.6.5.2-all-languages to phpmyadmin (for brevity).
In the c:Serverdatahtdocsphpmyadmin folder create config.inc.php file and copy there:
Open in your browser http://localhost/phpmyadmin/
Enter root as name, do not fill password. If everything is fine it should look like that:
In the c:Serverdatahtdocs folder put your local web sites, create HTML, PHP and another files. For instance, I created c:Serverdatahtdocstestajax.php file, so this file will be available at the address http://localhost/test/ajax.php and so on.
To create full backup including all web sites and databases, just copy data folder in a save place. If you will need restore your information, with backup you can do it easily.
Before updating web-server modules, backup bin folder, if you will have issues you can fallback to previous versions.
Make backup of the following files, with them you can deploy new instance of the server faster.
These files keep all settings and when we are installing new web server instance most of the time we are engaged in their editing
Some PHP settings you should know:
It is not necessary to do something with them, but if you are rested into the limits, they will be useful
If in phpMyAdmin you see error message:
Follow http://localhost/phpmyadmin/chk_rel.php and click
'Create a database named 'phpmyadmin' and setup the phpMyAdmin configuration storage there'.
You will see:
It means you fixed the problem.
In the C:Serverbin folder, create one more folder named Sendmail. Now in this new folder create a file sendmail.php and copy-paste the following content:
Open the C:ServerbinPHPphp.ini file and append the string:
Save the file and restart your web-server. From this moment every sent letter will be saved in C:ServerbinSendmailemails
You should add PHP folder to System PATH, otherwise you will have errors every time you start Apache:
To avoid that, add PHP folder to System PATH. Push the Start (‘Win’) button, start typing ‘Edit the system environment variables’ and open the setting window.
Click the ‘Environment Variables’ button:
In the window ‘System variables’ click on ‘Path’ and later on ‘Edit…’
Click on ‘New’ and type ‘C:ServerbinPHP’:
Lift the record to the very top:
Save changes and close all windows. Restart the server.
If you do not know what cURL is, then you do not need it. So feel free to skip this step.
cURL is a console utility that allows you to exchange data with remote servers using a very large number of protocols. cURL can use cookies and supports authentication. If a web application requires cURL, then this must be specified in the dependencies. For many popular applications, cURL is not required, for example, for phpMyAdmin and WordPress therefore there is no need to configure cURL.
If cURL is not configured correctly, you will get errors:
Or:
To make cURL works in Apache on Windows, you need:
1) Be sure to add the PHP directory to PATH (system environment variables). How to do this said just above: https://miloserdov.org/?p=55#12.
2) In the C:ServerbinPHPphp.ini file the extension=curl line should be uncommented.
3) Download the https://curl.haxx.se/ca/cacert.pem file, then in the C:Server folder create a new folder named certs and move the downloaded file to this new folder (C:Servercerts).
4) In the C:ServerbinPHPphp.ini file find the sting
And replace it with
5) Restart your web-server.
When you have hangs, slow traffic and/or when having in your log entries like Asynchronous AcceptEx failed.
You can try the following settings:
Recommended for you 'How to protect the Apache web server from hacking in Windows'.
If you no longer need a web-server installed with this guide, follow the steps below to uninstall it.
Attention: all the web-sites and their databases created on your local web-server will be deleted!
Stop services and remove them from auto start:
Delete the folder C:Server.
Last Updated on