1

I tried to setup XAMPP and WampServer, as well as manually downloading and setting up the latest installers for Apache+PHP+MySQL on Windows 10, but everytime time I get different errors. Can anyone give me advice on installing Apache+PHP+MySQL on Windows 10? I read in russian and do such info: 1) https://codeby.net/threads/ustanovka-i-nastrojka-servera-apache-php-mysql-phpmyadmin-na-windows-10.67181/ I get such error in starting last Apache: httpd.exe: Syntax error on line 75 of C:/server/bin/conf/httpd.conf: Cannot load modules/mod_actions.so into server: after that all modules loading with errors. 2) https://blog.denisbondar.com/post/apache24php56win7 I get error in starting last Apache similar to: [mpm_winnt:error] I download two programs, first is XAMPP 7.3.5, I install this program, and after starting nothing happens. I get such error:

[Sat May 11 10:50:47.974475 2019] [ssl:warn] [pid 8012:tid 528] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 11 10:50:48.097489 2019] [ssl:warn] [pid 8012:tid 528] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 11 10:50:48.150507 2019] [mpm_winnt:notice] [pid 8012:tid 528] AH00455: Apache/2.4.39 (Win64) OpenSSL/1.1.1b PHP/7.3.5 configured -- resuming normal operations
[Sat May 11 10:50:48.150507 2019] [mpm_winnt:notice] [pid 8012:tid 528] AH00456: Apache Lounge VC15 Server built: Mar 28 2019 11:59:33
[Sat May 11 10:50:48.150507 2019] [core:notice] [pid 8012:tid 528] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sat May 11 10:50:48.156507 2019] [mpm_winnt:notice] [pid 8012:tid 528] AH00418: Parent: Created child process 3212
[Sat May 11 10:50:49.104673 2019] [ssl:warn] [pid 3212:tid 132] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 11 10:50:49.176682 2019] [ssl:warn] [pid 3212:tid 132] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sat May 11 10:50:49.218705 2019] [mpm_winnt:notice] [pid 3212:tid 132] AH00354: Child: Starting 150 worker threads.

So, Apache not works(Attempting to start Apache service... "and nothing"). After that, I try to install last WampServer(wampserver 3.1.7). I get such window for mysqld: missing msvcp120.dll After that I tried to run 3 services of Wamp, and only two was started, Apache localhost works, what is not started I don't know. So, I tried to install msvcp120 but nothing happens.

3
  • 2
    That question is a bit broad and you haven't given us a clue what the errors are that you are getting. I'm a big fan of installing each component manually (no installers) to get the best and most detailed understanding of each piece and how they work together. I would install PHP first followed by Apache and save MariaDB/MySQL for last.
    – Dave
    Commented May 10, 2019 at 17:03
  • 1
    Please edit your question to include details about the errors. This is unsolvable without the additional information. Commented May 10, 2019 at 19:53
  • I added such info
    – Vytas P.
    Commented May 12, 2019 at 7:29

1 Answer 1

5

Installation

Apache

Download a copy of Apache from Apache Lounge. You will probably want to download a current 64-bit edition (httpd-2.4.43-win64-VS16.zip). Once the .zip file is downloaded, extract the contents. Move the Apache24 folder to a location where you would like it to reside permanently. Note that Apache24, as a rule, should not be placed in:

  • Any "Program Files" folders.
  • Any "User" folder.
  • Anywhere under AppData.

Apache should reside in a path without spaces (e.g. C:\Apache24 by default). You will likely need to install the proper Visual Studio 2015-2019 C++ Redistributables as well.

PHP

Once you have Apache, download PHP. As indicated by the PHP.net sidebar, when using Apache, you need to use the "Thread Safe" versions of PHP. The latest Thread Safe version of PHP 64-bit is php-7.4.3-Win32-vc15-x64.zip. Similar to Apache, extract the .zip file and place its contents in a location where you would like it to reside permanently (e.g. C:\PHP7). You will likely wish to avoid the same system-controlled folders as for Apache (above).

MySQL

Lastly, download MySQL Community Edition. You can use the version which you find the most suitable, but for maximum compatibility you may wish to consider the older MySQL 5.x branch. As a recommendation, I might suggest the last 5.5 branch 64-bit installer (mysql-5.5.62-winx64.msi). You may wish to select a Custom installation type and place MySQL in a folder other than "Program Files", however this is less important than with Apache or PHP.

Note that MySQL comes with a "MySQL Server Instance Configuration Wizard". This can be ran automatically after installing MySQL. However, you can uncheck this option after installation is completed and run the same wizard at any time with MySQLInstanceConfig.exe in your MySQL bin folder.


Configuration

Apache

Assuming you installed Apache into C:\Apache24 (above), Apache should need no further tweaking to run. You should be able to start Apache with C:\Apache24\bin\httpd.exe and go to localhost or 127.0.0.1 and see It Works! as a message returned in the browser. The default folder for web documents (.html files, .php scripts, etc.) is e.g. C:\Apache24\htdocs.

PHP

Copy either php.ini-development or php.ini-production and rename the duplicated file php.ini (all of these are typically located in the root of your PHP installation folder e.g. C:\PHP7). The choice of which file to base your configuration off of (php.ini-development versus php.ini-production) is up to you. As indicated, php.ini-development is a configuration intended for developers and php.ini-production is a slightly more secure configuration intended for production (i.e. for use on servers exposed to the internet).

PHP generally shouldn't need additional configuration unless your script requires specific functions or modules that aren't a part of PHP's defaults. That said, you can uncomment any necessary options in php.ini once it is created (remove the # at the start of the line and save the file). Any specific PHP configuration options required by your script(s) would likely be found with the source of the original script (i.e. on the website).

MySQL

Run MySQLInstanceConfig.exe under the bin directory of your MySQL installation directory (e.g. C:\MySQL Server 5.5\bin\MySQLInstanceConfig.exe). Choose Detailed Configuration. The following options should work as a basic setup:

  • Developer Machine (minimal memory usage).
  • Multifunctional Database (InnoDB and MyISAM storage engines).
  • Default placement of the InnoDB datafile (installation path).
  • Online Transaction Processing (OLTP). Up to 500 connections. Note that selecting this option can be extremely important. Using a different option/number of connections may prevent the MySQL service from starting.
  • Default networking options (Enable TCP/IP connections on port 3306, make sure to check "Add firewall exception for this port", Enable Strict Mode).
  • Standard Character Set (Latin1). If you are not using a "Western European" language, you may wish to choose "Best Support for Multilingualism" (UTF8).
  • Install As A Windows Service. Check the "Launch the MySQL Server automatically" option.
  • Include Bin Directory in Windows Path (optional). This simply makes it possible to run programs in your MySQL bin folder from the command line (in case you need them in a script, to check your MySQL version with mysqld -V, to easily manage MySQL as a service, etc.).
  • Modify Security Settings (type in a new root password for accessing MySQL so you can log in with e.g. username root and password password_you_chose). For security, "Create An Anonymous Account" can be left unchecked in most cases, as can "Enable root access from remote machines" (unless you really need it).

Once all the appropriate options are selected, press the "Execute" button to apply your changes. The basic options given will be recorded in my.ini in your root MySQL directory. MySQL should now be running in the background as a service (independent of Apache/PHP).


Apache & PHP

To enable PHP processing with Apache, you will need to edit your httpd.conf file (e.g. C:\Apache24\conf\httpd.conf) as indicated below . Place the following lines at the end of httpd.conf:

# ----- PHP Configuration -----

# LoadModule php7_module "c:/PHP7/php7apache2_4.dll"

LoadModule php7_module "c:/PHP7/php7apache2_4.dll"
AddHandler application/x-httpd-php .php

# Configure the path to php.ini
# PHPIniDir "c:/PHP7"

PHPIniDir "c:/PHP7"

c:/PHP7 should match whatever directory you installed PHP into and php.ini should already exist (see PHP Configuration above). Don't forget to save your changes and restart your Apache server.

You can verify that PHP is working on Apache by creating a .php file with the following line:

<?php phpinfo()?>

Save this as ex. version.php and place it in your root web directory (e.g. C:\Apache24\htdocs). You should be able to then navigate to ex. http://localhost/version.php and see a large amount of information about your PHP installation.


Apache Notes

  • Starting Apache manually (i.e. not as a service) by running httpd.exe directly should generally produce no errors. However, to avoid a warning regarding Apache being unable to resolve a FQDN for the server, you may wish to uncomment the ServerName entry in httpd.conf (e.g. C:\Apache24\conf\httpd.conf). The default www.example.com:80 works fine.

  • As indicated already, after updating httpd.conf or php.ini, you should always restart Apache to ensure your changes take effect.

  • If Apache will not start and/or generates errors, you should have a look at the logs to determine a cause (e.g. C:\Apache24\logs\error.log).

  • Starting Apache manually with httpd.exe or with httpd.exe -k start (if Apache is installed as a service) may reveal specific configuration issues and the relevant files/line(s) Apache is having trouble with parsing.

  • To use an installation directory other than C:\Apache24 or a web document root other than C:\Apache24\htdocs, you will need to edit httpd.conf. There may be other changes you need to make to this file to set up your web server correctly as well.

  • To enable SSL connections (HTTPS), you will need to obtain an SSL certificate and you will need to edit httpd-ssl.conf.

  • Apache is moderately security-conscious regarding which folders it allows to run scripts. If your PHP scripts are failing, they may not have the correct permissions to run.


Service Notes

  • Services can be managed via Services (Start Menu → Run/Search → "services" Enter).

  • Working with any Windows service requires administrative privileges, including an elevated command prompt (Start Menu → Run/Search → "cmd" Control + Shift + Enter).

  • You can install Apache as a service with httpd.exe. From an elevated command prompt (above), navigate to e.g. C:\Apache24\bin and run:

    httpd -k install -n "Apache2.4"
    
  • On Windows, "Apache2.4" should be the default Apache service name. Using any other service name may cause issues.

  • If you have attempted to install Apache or MySQL as a service before, you may need to ensure they are no longer registered with Windows. First, make certain the service is stopped (again, you can check this with the Services via Start Menu → Run/Search → "services" Enter). Assuming the service isn't running, open an elevated command prompt (above), then run e.g. sc delete Apache2.4 or sc delete MySQL.

  • Alternately, Apache and MySQL have ex. httpd -k uninstall -n "Apache2.4" (e.g. C:\Apache24\bin\httpd.exe) and ex. mysqld --remove (e.g. C:\MySQL Server 5.5\bin\mysqld.exe) to remove each respective service.


Caveats

  • As already noted under the MySQL configuration section, selecting anything other than Online Transaction Processing (OLTP) for the number of concurrent connections (up to 500) may prevent the MySQL service from starting. Symptoms include the MySQL Server Instance Configuration Wizard "hanging" when attempting to start the MySQL service (after pressing "Execute") or the inability to manually start the service in Windows (System error 1607 has occurred.)

Not the answer you're looking for? Browse other questions tagged .