INSTALLING APACHE 2.4 + PHP 5.6 + MYSQL 5.6 ON WINDOWS 7/8 / 8.1

http://blog.denisbondar.com/post/apache24php56win7#comment-5848

This manual will be useful for beginners WEB-programmers who are going to install in your PC with Windows WEB-Apache server with PHP interpreter latest versions. Of course, much easier to establish an assembly like Denwer and soared over the settings. However, each WEB-programmer would have to understand the process works the WEB-server, the process of installing, configuring.

This article describes how to install bundles Apache 2.4 + PHP 5.6 + MySQL 5.6 on Windows 7/8 / 8.1

Please note that the data under Windows XP version of VC11 run it will be impossible (or extremely difficult).

Preparatory work

Make sure you have the name Windows 7 or later. If you have Windows XP, this guide will help you as described here is a version of Apache does not work under Windows XP.

Remove all the WEB-servers that set this up, go to the service and make sure that there are no services, Apache or IIS. If you already have a web server, a second parallel likely will not work at all.

If you have Skype, be sure to turn off in the settings to use port 80.

To use it is very desirable to have a file manager that allows you to create files with any extensions, or, better yet, a code editor, like Sublime Text or Notepad ++.

The folder structure may be different, but this guide is written for a specific structure and, if it follow, all guaranteed to work. 
Before you begin, create a disk D  folder USR, inside which create 5 podpapkok: apache, php, tmp, www,log . Exactly. Not specified version number.

In the catalog www create a file (using the file manager or the code editor):

  • index.html with the contents: It works!
  • index.php with the content: <? php phpinfo (); ?>

If a file manager / code editor there, download the archive with these two files on this page. But still, it is better to get the above instruments.

The PATH system variable add:

If someone does not know how to find the place where I PATH, read this one comment.

Notes!

These examples of configuration files line numbers may be different for other versions of apache and php. 
All teams, including editing the file, must be carried out on behalf of the Administrator.

Installing Apache 2.4

Although a simple PHP development and there is no need for a separate WEB-server (with PHP built its own WEB-server, which is almost always sufficient for the development of the project), it is still recommended to install and configure the WEB-server Apache, though, because that the programmer has to know these details.In the end, you have to work with WEB-server and have to deal with its configuration. So we proceed.

  1. Load Apache 2.4 binaries VC11  under their system linkhttp://www.apachelounge.com/download/VC11/  Most likely you have a 64 bit OS, so you need a file called httpd-2.4.16-win64-VC11.zip
  2. If you need some additional modules, can be downloaded in the same place (for basic software installation is not necessary)
  3. Unpack the contents of the folder Apache24 from the downloaded archive to D: \ USR \ apache. Please note that the D: \ USR \ apache does not need to put Apache24 folder from the archive and its contents.Install anything required.
  4. The file D: \ USR \ apache \ conf \ httpd.conf change the value of ServerRoot on “d: / USR / apache”(line 37) and the value of DocumentRoot (and Direcroty) in the “d: / USR / www” (line 242 and 243). The same should be uncommented line 218 and change it to: ServerName localhost: 80
  5. Change storage settings logs in the same file (find and change settings):
  6. Install Service Apache (administrator). Open a command prompt as an administrator and insert the following line:
  7. We follow the error messages during installation of the service. If done right, no mistakes should not be. If you are after the line has not appeared again the command line, then you have done something wrong. Just use the copy and paste functions to prevent errors in reprinting.
  8. Create a desktop shortcut to D: \ USR \ apache \ bin \ ApacheMonitor.exe and / or put it in startup (to open the startup WIN8 to press WIN + R, then type shell: Startup and click OK)
  9. Run ApacheMonitor. The system tray icon appears. Click on a left button, choose Apache24 -> Start.
  10. In your browser, go to http: // localhost / – should see It works!
  11. If you do not see this line, figuring out what went wrong (read the logs, Google, attempt to deal with the problem, once decided to understand the intricacies of the web server)

Installing PHP 5.6

  1. Download the latest version of VC11 x86 machines  Thread Safe  or VC11 x64  Thread Safe  linkhttp://windows.php.net/download/. Please note that you need is VC11 and is Thread Safe. Bit must be like Apache. The file that you need, most likely will be called like: php-5.6.11-Win32-VC11-x86.zip or php-5.6.11-Win32-VC11-x64.zip
  2. Extract the archive to D: \ USR \ php. As is the case with Apache, is not required to install anything.
  3. The file D: \ USR \ apache \ conf \ httpd.conf add the line:
  4. And changes the value DirectoryIndex on index.html index.php (line 276)
  5. Using ApacheMonitor restart Apache (Apache24 -> Restart)
  6. Go browser http: //localhost/index.php and make sure that PHP is working.
  7. Make a copy of the file D: \ USR \ php \ php.ini-development named D: \ USR \ php \ php.ini
  8. Using the search find uncomment and change the settings:
  9. Execute the command line php -m to view the list of connected modules.
  10. Restart Apache using ApacheMonitor

Virtual Hosts in Apache

  1. If the computer you are debugging multiple projects, you may need virtual hosts (sites). For example, we will consider two virtual hosts: s1.localhost and s2.localhost. For convenience, we will create a folder with the same names that are not necessarily in the real system.
  2. Note that when using virtual hosts, setting DocumentRoot Apache configuration file is no longer meaningful. The main host server (which will be available at http: // localhost /) is now the first virtual host in the configuration file virtual hosts!
  3. First we need to add to the file c: \ Windows \ System32 \ drivers \ etc \ hosts line:

    This should be done on behalf of the Administrator. Preferably after this reboot, but in practice this is not required. If you can not change the file (access rights), you can copy it to the desktop, to change, and then copy back.

  4. Create a folder for virtual hosts D: \ USR \ www \ s1.localhost and D: \ USR \ www \ s2.localhost,which will house the files. In each folder create a file index.html with the contents of S1 and S2, respectively (for a control that everything works as it should)
  5. Then create a folder for the logging: D: \ USR \ log \ s1.localhost and D: \ USR \ log \ s2.localhost  – then logs will be stored for each of the sites. In fact, the logs can be stored in the same folder, but I used to do so – to me so it is more convenient.
  6. Next you need to enable virtual hosts. The file D: \ USR \ apache \ conf \ httpd.conf uncommented lineInclude conf / extra / httpd-vhosts.conf
  7. Next, edit the file d: \ USR \ apache \ conf \ extra \ httpd-vhosts.conf – it should look like (each virtual host its block VirtualHost):
  8. The first virtual host s1.localhost will now be the main host system, because it should be the first block in the configuration file, ie It will be available at the entrance to http: // localhost /
  9. Restart Apache using ApacheMonitor and go on line to http: //s1.localhost/ and http: //s2.localhost/.
  10. So. To add a new virtual host will be enough: create a folder for the hosts file in D: \ USR \ www, create a folder for the log host in the D: \ USR \ log, to register the host name in the file hosts, add a block VirtualHost configuration file virtual hosts.

Installing MySQL 5.6

  1. Load MySQL Installer MSI (mysql-installer-community) link: http://dev.mysql.com/downloads/windows/installer/5.6.html  (requires registration on the website)
  2. During the installation at the stage of Choosing a Setup Type  choose:  Custom, then remove all of the installed products (in the right column), with the exception of the MySQL server (will be automatically added to the required mandatory modules). Simply remove all and add only the server – all necessary components will be added while themselves
    mysql-win-choose
  3. Start the installation by clicking on Execute in the next window
  4. After installing the server, press several times Next and proceed to configuring the server
  5. Choose the type of Development Machine, leave the option as it is and click Next
  6. Set the password of the main user root (mandatory) – Here you can add users, but yet do not need, click Next
  7. Specifies whether to make the server start automatically with the start of Windows (I have autorun is disabled, because local MySQL-server is used only for debugging in very rare cases), click Next
  8. Run the configuration click the Execute. Everything has to be successful, and then click Next and thenFinish.
  9. Install the MySQL server is complete. Congratulations!
  10. If you have left in the startup configuration server, then nothing more needs to be done. MySQL Server will start automatically with the start of the operating system Windows. Otherwise you’ll have to run a server from Windows Services  control panel computer Windows (or write your miniskript to start and stop the service). I’m working on a laptop and constantly running server I do not need (consumption of resources).
  11. To work with MySQL server has many useful and convenient tools. I recommend using  dbforge Studio for MySQL. With this tool, you can create database users and assign access rights. Perhaps there is a more convenient and fast tool. From all that I have used the most functional, though not particularly fast.