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).
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.
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.
- 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
- If you need some additional modules, can be downloaded in the same place (for basic software installation is not necessary)
- 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.
- 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
- Change storage settings logs in the same file (find and change settings):
12ErrorLog “D:/USR/log/apache-error.log”CustomLog “D:/USR/log/apache-access.log” common
- Install Service Apache (administrator). Open a command prompt as an administrator and insert the following line:
1D:\USR\apache\bin\httpd.exe –k install
- 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.
- 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)
- Run ApacheMonitor. The system tray icon appears. Click on a left button, choose Apache24 -> Start.
- In your browser, go to http: // localhost / – should see It works!
- 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
- 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
- Extract the archive to D: \ USR \ php. As is the case with Apache, is not required to install anything.
- The file D: \ USR \ apache \ conf \ httpd.conf add the line:
1234LoadModule php5_module “d:/USR/php/php5apache2_4.dll”AddHandler application/x–httpd–php .php# Путь к файлу php.iniPHPIniDir “D:/USR/php”
- And changes the value DirectoryIndex on index.html index.php (line 276)
- Using ApacheMonitor restart Apache (Apache24 -> Restart)
- Go browser http: //localhost/index.php and make sure that PHP is working.
- Make a copy of the file D: \ USR \ php \ php.ini-development named D: \ USR \ php \ php.ini
- Using the search find uncomment and change the settings:
123456extension_dir = “D:/USR/php/ext”sys_temp_dir = “D:/USR/tmp”extension=php_mysql.dllextension=php_mysqli.dllextension=php_openssl.dlldate.timezone = Europe/Zaporozhye
- Execute the command line php -m to view the list of connected modules.
- Restart Apache using ApacheMonitor
Virtual Hosts in Apache
- 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.
- 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!
- First we need to add to the file c: \ Windows \ System32 \ drivers \ etc \ hosts line:
12127.0.0.1 s1.localhost127.0.0.1 s2.localhost
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.
- 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)
- 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.
- Next you need to enable virtual hosts. The file D: \ USR \ apache \ conf \ httpd.conf uncommented lineInclude conf / extra / httpd-vhosts.conf
- Next, edit the file d: \ USR \ apache \ conf \ extra \ httpd-vhosts.conf – it should look like (each virtual host its block VirtualHost):
1234567891011121314151617<VirtualHost *:80>ServerAdmin email@example.comDocumentRoot “D:/USR/www/s1.localhost”ServerName s1.localhostServerAlias www.s1.localhostErrorLog “D:/USR/log/s1.localhost/error.log”CustomLog “D:/USR/log/s1.localhost/access.log” common</VirtualHost><VirtualHost *:80>ServerAdmin firstname.lastname@example.orgDocumentRoot “D:/USR/www/s2.localhost”ServerName s2.localhostServerAlias www.s2.localhostErrorLog “D:/USR/log/s2.localhost/error.log”CustomLog “D:/USR/log/s2.localhost/access.log” common</VirtualHost>
- 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 /
- Restart Apache using ApacheMonitor and go on line to http: //s1.localhost/ and http: //s2.localhost/.
- 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
- Load MySQL Installer MSI (mysql-installer-community) link: http://dev.mysql.com/downloads/windows/installer/5.6.html (requires registration on the website)
- 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
- Start the installation by clicking on Execute in the next window
- After installing the server, press several times Next and proceed to configuring the server
- Choose the type of Development Machine, leave the option as it is and click Next
- Set the password of the main user root (mandatory) – Here you can add users, but yet do not need, click Next
- 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
- Run the configuration click the Execute. Everything has to be successful, and then click Next and thenFinish.
- Install the MySQL server is complete. Congratulations!
- 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).
- 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.