<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Antonin Neumann</title>
    <description>The latest articles on DEV Community by Antonin Neumann (@tonda13).</description>
    <link>https://dev.to/tonda13</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F10945%2FZj0G_08d.jpeg</url>
      <title>DEV Community: Antonin Neumann</title>
      <link>https://dev.to/tonda13</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tonda13"/>
    <language>en</language>
    <item>
      <title>Install and setup Apache + MySQL + PHP on Windows</title>
      <dc:creator>Antonin Neumann</dc:creator>
      <pubDate>Tue, 01 Oct 2019 11:27:40 +0000</pubDate>
      <link>https://dev.to/tonda13/install-and-setup-apache-mysql-php-on-windows-pd1</link>
      <guid>https://dev.to/tonda13/install-and-setup-apache-mysql-php-on-windows-pd1</guid>
      <description>&lt;h1&gt;
  
  
  Download
&lt;/h1&gt;

&lt;p&gt;You can download the required installer via links given below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apache for Windows: &lt;a href="https://www.apachelounge.com/download/"&gt;https://www.apachelounge.com/download/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;PHP 7 for Windows (select &lt;strong&gt;Thread Safe&lt;/strong&gt;): &lt;a href="https://windows.php.net/download/"&gt;https://windows.php.net/download/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MariaDB for Windows: &lt;a href="https://downloads.mariadb.org/"&gt;https://downloads.mariadb.org/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;FakeSMTP (needed for Windows) &lt;a href="http://nilhcem.com/FakeSMTP/download.html"&gt;http://nilhcem.com/FakeSMTP/download.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  MariaDB
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Firstly install MariaDB server&lt;/li&gt;
&lt;li&gt;If you needed you can change port during installation process. &lt;em&gt;If you changed it then you improve you must connection string in PHP.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Apache 2.4 server
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Install  the latest C++ Redistributable Visual Studio 2017: &lt;a href="https://www.microsoft.com/en-in/download/details.aspx?id=48145"&gt;https://www.microsoft.com/en-in/download/details.aspx?id=48145&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unzip downloaded Apache archive to the &lt;code&gt;C:\Apache24\&lt;/code&gt; (or somewhere else) directory.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After unzipping, go to the folder &lt;code&gt;C:\Apache24\conf\&lt;/code&gt; and open the &lt;code&gt;httpd.conf&lt;/code&gt; file by any text editor.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In this file change this line&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;# ServerName www.example.com:80&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;with&lt;code&gt;httpd.conf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ServerName localhost&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Find all occurrences of &lt;code&gt;AllowOverride None&lt;/code&gt; &lt;br&gt;
and change them to &lt;code&gt;AllowOverride All&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enable &lt;strong&gt;mod_rewrite&lt;/strong&gt; by uncomment following line &lt;br&gt;
&lt;code&gt;#LoadModule rewrite_module modules/mod_rewrite.so&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Register Apache service
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;open console and go to Apache directory
&lt;code&gt;cd Apache24/bin&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;then type following command
&lt;code&gt;httpd -k install&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;now you can see Apache service in &lt;em&gt;Services&lt;/em&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Some PRO tips
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Change your DocumentRoot
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can change default directory where Apache will be looking for websites
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="n"&gt;DocumentRoot&lt;/span&gt; &lt;span class="s2"&gt;"L:/"&lt;/span&gt;
&amp;lt;&lt;span class="n"&gt;Directory&lt;/span&gt; &lt;span class="s2"&gt;"L:/"&lt;/span&gt;&amp;gt;
    &lt;span class="n"&gt;Options&lt;/span&gt; &lt;span class="n"&gt;Indexes&lt;/span&gt; &lt;span class="n"&gt;FollowSymLinks&lt;/span&gt;
    &lt;span class="n"&gt;AllowOverride&lt;/span&gt; &lt;span class="n"&gt;All&lt;/span&gt;
    &lt;span class="n"&gt;Require&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="n"&gt;granted&lt;/span&gt;
&amp;lt;/&lt;span class="n"&gt;Directory&lt;/span&gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add custom virtual hosts w/ local domains
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can also create virtual host with custom local domain for each your projects. Append following to &lt;code&gt;httpd.conf&lt;/code&gt; file (for each project):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;VirtualHost 127.0.0.1:80&amp;gt;
    ServerAdmin your.name@gmail.com
    DocumentRoot "L:/MyProject"
    ServerName www.myproject.loc
    ServerAlias myproject.loc
    ServerAlias www.myproject.lc
    ServerAlias myproject.lc
    ErrorLog "logs/myproject.log"
&amp;lt;/VirtualHost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Then you must edit the &lt;code&gt;hosts&lt;/code&gt; file, in Windows is located in &lt;code&gt;C:\Windows\System32\drivers\etc&lt;/code&gt;. In this file append following line

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;127.0.0.1    www.myproject.loc myproject.loc www.myproject.lc myproject.lc&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Change Apache default port
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You can change default port where Apache server will be listen 

&lt;ul&gt;
&lt;li&gt;just change &lt;code&gt;Listen 80&lt;/code&gt; to e.g. &lt;code&gt;Listen 8008&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;and restart service&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;From now you see your website on &lt;a href="http://localhost:8008/"&gt;&lt;/a&gt;&lt;a href="http://localhost:8008/"&gt;http://localhost:8008/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  PHP
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Unzip downloaded PHP archive to the &lt;code&gt;C:\php7\&lt;/code&gt; (or somewhere else) directory.&lt;/li&gt;
&lt;li&gt;Rename or copy &lt;code&gt;php-ini-development.ini&lt;/code&gt; to &lt;code&gt;php.ini&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Open &lt;code&gt;php.ini&lt;/code&gt; and edit:

&lt;ul&gt;
&lt;li&gt;Find section &lt;strong&gt;Dynamic Extensions&lt;/strong&gt; and uncomment extension which you want to load, here is listing good base of enabled extensions: &lt;strong&gt;bz2&lt;/strong&gt;, &lt;strong&gt;curl&lt;/strong&gt;, &lt;strong&gt;fileinfo&lt;/strong&gt;, &lt;strong&gt;intl&lt;/strong&gt;, &lt;strong&gt;imap&lt;/strong&gt;, &lt;strong&gt;mbstring&lt;/strong&gt;, &lt;strong&gt;mysqli&lt;/strong&gt;, &lt;strong&gt;openssl&lt;/strong&gt;, &lt;strong&gt;pdo_mysql&lt;/strong&gt;, &lt;strong&gt;pdo_sqlite&lt;/strong&gt;, &lt;strong&gt;sqlite3&lt;/strong&gt;, &lt;strong&gt;xsl&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Then change SMTP port to &lt;code&gt;smtp_port = 2525&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Add PHP in system environment variable.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;in cmd type

&lt;code&gt;setx path "%PATH%, C:\php7" /M&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;Open Apache configuration file (&lt;code&gt;c:\Apache24\conf\httpd.conf&lt;/code&gt;) again&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;and append following lines:
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight conf"&gt;&lt;code&gt;&lt;span class="n"&gt;PHPIniDir&lt;/span&gt; &lt;span class="s2"&gt;"C:/PHP7"&lt;/span&gt;
&lt;span class="n"&gt;AddHandler&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt;/&lt;span class="n"&gt;x&lt;/span&gt;-&lt;span class="n"&gt;httpd&lt;/span&gt;-&lt;span class="n"&gt;php&lt;/span&gt; .&lt;span class="n"&gt;php&lt;/span&gt;
&lt;span class="n"&gt;LoadModule&lt;/span&gt; &lt;span class="n"&gt;php7_module&lt;/span&gt; &lt;span class="s2"&gt;"C:/PHP7/php7apache2_4.dll"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Then change &lt;strong&gt;DirectoryIndex&lt;/strong&gt; from &lt;code&gt;index.html&lt;/code&gt; to:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;IfModule dir_module&amp;gt;
    DirectoryIndex index.php
&amp;lt;/IfModule&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  FakeSMTP
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;FakeSMTP is Java application which simulate SMTP server for local developing on Windows.&lt;/li&gt;
&lt;li&gt;You can start it with following command: &lt;code&gt;start java -jar C:\sw\faceSMTP\fakeSMTP-2.0.jar --start-server --background --port 2525 --bind-address 127.0.0.1 --output-dir L:\_emails&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Or you can create command file (e.g.: &lt;code&gt;fakesmpt.cmd&lt;/code&gt;) with following content:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@echo off
start java -jar C:\sw\faceSMTP\fakeSMTP-2.0.jar --start-server --background --port 2525 --bind-address 127.0.0.1 --output-dir L:\_emails
exit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>apache</category>
      <category>php</category>
      <category>mysql</category>
      <category>mariabd</category>
    </item>
  </channel>
</rss>
